Advertisement
DrawingJhon

Walk Controller

Aug 24th, 2023 (edited)
1,024
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. for _, target in game:GetService("Players"):GetPlayers() do
  2. local tool = Instance.new("Tool")
  3. tool.Name = target.Name.." walk controller"
  4. tool.RequiresHandle = false
  5. tool.CanBeDropped = false
  6.  
  7. local scr = NLS([[local tool = script.Parent
  8. local remote = tool:WaitForChild("Remote")
  9. local target = tool:WaitForChild("Target").Value
  10.  
  11. tool.Activated:Connect(function()
  12.     local stop = false
  13.  
  14.     tool.Deactivated:Once(function()
  15.         stop = true
  16.     end)
  17.  
  18.     while not stop do
  19.         remote:FireServer(owner:GetMouse().Hit.Position)
  20.         task.wait(0.1)
  21.     end
  22. end)
  23. ]], tool)
  24.  
  25. local remote = Instance.new("RemoteEvent")
  26. remote.Name = "Remote"
  27. remote.OnServerEvent:Connect(function(player, pos)
  28.     if player ~= owner then return end
  29.    
  30.     target.Character.Humanoid:MoveTo(pos)
  31. end)
  32.  
  33. remote.Parent = tool
  34.  
  35. local val = Instance.new("ObjectValue")
  36. val.Value = target
  37. val.Name = "Target"
  38. val.Parent = tool
  39.  
  40. tool.Parent = owner.Backpack
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement