olivia1246

Roblox Follow LocalScript (No Jump) Specific User

Jul 24th, 2024 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Players = game:GetService("Players")
  2. local localPlayer = Players.LocalPlayer
  3. local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
  4. local humanoid = character:WaitForChild("Humanoid")
  5. local rootPart = character:WaitForChild("HumanoidRootPart")
  6.  
  7. local targetUsername = "AdoptMe9943"
  8.  
  9. local function findTargetRootPart()
  10.     for _, player in ipairs(Players:GetPlayers()) do
  11.         if player.Name == targetUsername then
  12.             local otherCharacter = player.Character
  13.             if otherCharacter then
  14.                 local otherRootPart = otherCharacter:FindFirstChild("HumanoidRootPart")
  15.                 local otherHumanoid = otherCharacter:FindFirstChild("Humanoid")
  16.                
  17.                 if otherRootPart and otherHumanoid and otherHumanoid.Health > 0 then
  18.                     return otherRootPart
  19.                 end
  20.             end
  21.         end
  22.     end
  23.    
  24.     return nil
  25. end
  26.  
  27. while true do
  28.     local target = findTargetRootPart()
  29.     if target then
  30.         humanoid:MoveTo(target.Position)
  31.     end
  32.     task.wait(0.1)
  33. end
Advertisement
Add Comment
Please, Sign In to add comment