Advertisement
ColdSpecs

Follow Player

Jul 13th, 2023 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. -- Generated From Chat GPT-4
  2. -- Auto Follow | Keybind: X
  3. local tr = false
  4. local Mouse = game.Players.LocalPlayer:GetMouse()
  5.  
  6. game:GetService("UserInputService").InputBegan:Connect(function(key, gpe)
  7. if key.KeyCode == Enum.KeyCode.X and not gpe and tr == false then
  8. tr = true
  9. for i, v in pairs(game.Players:GetPlayers()) do
  10. local char = game.Players.LocalPlayer.Character
  11. if v.Name ~= char.Name and (v.Character.HumanoidRootPart.CFrame.p - char.HumanoidRootPart.CFrame.p).Magnitude < 25 then
  12. while tr == true do
  13. if v.Character.HumanoidRootPart.Velocity.magnitude > 0.5 and v.Character:FindFirstChild("Head") then
  14. char.Humanoid:MoveTo(v.Character.HumanoidRootPart.CFrame.p + v.Character.HumanoidRootPart.Velocity.unit * 7)
  15. elseif v.Character.HumanoidRootPart.Velocity.magnitude < 0.5 and v.Character:FindFirstChild("Head") then
  16. char.Humanoid:MoveTo(v.Character.HumanoidRootPart.CFrame.p)
  17. elseif not v.Character:FindFirstChild("Head") then
  18. tr = false
  19. end
  20. task.wait()
  21. end
  22. end
  23. end
  24. elseif key.KeyCode == Enum.KeyCode.X and not gpe and tr == true then
  25. tr = false
  26. end
  27. end
  28. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement