Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- в паучка самого --
- local Spider = script.Parent
- local mob = workspace:WaitForChild("Mobs")
- local x = Spider.Part1.Position.X
- local y = Spider.Part1.Position.Y
- local z = Spider.Part1.Position.Z
- Spider.Part1.Position = Vector3.new(Spider.HumanoidRootPart.Position.X, Spider.HumanoidRootPart.Position.Y, Spider.HumanoidRootPart.Position.Z)
- Spider.Part1.Anchored = true
- Spider.Part1.WeldConstraint.Part0 = nil
- Spider.Part1.WeldConstraint.Part1 = nil
- print(x, y, z)
- while wait(2) do
- local maxDistance = 30 - корректируйте под радиус
- local maxDistance2 = 9.6 - корректируйте под карту ну или смотрите всё как сказано в видео
- local maxDistance3 = 4.85 - корректируйте под карту ну или смотрите всё как сказано в видео
- print(maxDistance)
- local targetFound = false
- for i, target in pairs(mob:GetChildren()) do
- if target:FindFirstChild("HumanoidRootPart") then
- local distance = (Spider.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
- print(target.Name, distance)
- if distance < maxDistance then
- targetFound = true
- Spider.Humanoid:MoveTo(Vector3.new(target.HumanoidRootPart.Position.X, Spider.HumanoidRootPart.Position.Y, target.HumanoidRootPart.Position.Z))
- if distance < maxDistance2 and distance > maxDistance3 then
- targetFound = false
- if targetFound == false then
- Spider.Humanoid:MoveTo(Vector3.new(Spider.Part1.Position.X, Spider.Part1.Position.Y, Spider.Part1.Position.Z))
- end
- end
- end
- end
- end
- end
- -- game controller в самый конец --
- while true do
- if selectedTower and camera:FindFirstChild("SpiderRange") then
- local range = selectedTower.Config.Range2.Value
- local height = (selectedTower.PrimaryPart.Size.Y / 2) + selectedTower.Humanoid.HipHeight
- local offset = CFrame.new(0, -height, 0)
- camera:FindFirstChild("SpiderRange").CFrame = selectedTower.PrimaryPart.CFrame * offset * CFrame.Angles(0, 0, math.rad(90))
- end
- task.wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement