Advertisement
Timon-Gun

скрипты для своего ттд 11 часть

Sep 27th, 2024
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. -- в паучка самого --
  2. local Spider = script.Parent
  3. local mob = workspace:WaitForChild("Mobs")
  4.  
  5. local x = Spider.Part1.Position.X
  6. local y = Spider.Part1.Position.Y
  7. local z = Spider.Part1.Position.Z
  8. Spider.Part1.Position = Vector3.new(Spider.HumanoidRootPart.Position.X, Spider.HumanoidRootPart.Position.Y, Spider.HumanoidRootPart.Position.Z)
  9. Spider.Part1.Anchored = true
  10. Spider.Part1.WeldConstraint.Part0 = nil
  11. Spider.Part1.WeldConstraint.Part1 = nil
  12. print(x, y, z)
  13.  
  14.  
  15. while wait(2) do
  16. local maxDistance = 30 - корректируйте под радиус
  17. local maxDistance2 = 9.6 - корректируйте под карту ну или смотрите всё как сказано в видео
  18. local maxDistance3 = 4.85 - корректируйте под карту ну или смотрите всё как сказано в видео
  19. print(maxDistance)
  20.  
  21. local targetFound = false
  22.  
  23. for i, target in pairs(mob:GetChildren()) do
  24. if target:FindFirstChild("HumanoidRootPart") then
  25. local distance = (Spider.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
  26. print(target.Name, distance)
  27.  
  28. if distance < maxDistance then
  29. targetFound = true
  30. Spider.Humanoid:MoveTo(Vector3.new(target.HumanoidRootPart.Position.X, Spider.HumanoidRootPart.Position.Y, target.HumanoidRootPart.Position.Z))
  31. if distance < maxDistance2 and distance > maxDistance3 then
  32. targetFound = false
  33.  
  34. if targetFound == false then
  35. Spider.Humanoid:MoveTo(Vector3.new(Spider.Part1.Position.X, Spider.Part1.Position.Y, Spider.Part1.Position.Z))
  36. end
  37. end
  38. end
  39. end
  40. end
  41.  
  42. end
  43. -- game controller в самый конец --
  44. while true do
  45. if selectedTower and camera:FindFirstChild("SpiderRange") then
  46. local range = selectedTower.Config.Range2.Value
  47. local height = (selectedTower.PrimaryPart.Size.Y / 2) + selectedTower.Humanoid.HipHeight
  48. local offset = CFrame.new(0, -height, 0)
  49. camera:FindFirstChild("SpiderRange").CFrame = selectedTower.PrimaryPart.CFrame * offset * CFrame.Angles(0, 0, math.rad(90))
  50. end
  51. task.wait()
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement