HowToRoblox

MovementHandler

Jul 14th, 2021 (edited)
1,471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2.  
  3. local cas = game:GetService("ContextActionService")
  4.  
  5. cas:UnbindAction("moveForwardAction")
  6. cas:UnbindAction("moveBackwardAction")
  7. cas:UnbindAction("moveLeftAction")
  8. cas:UnbindAction("moveRightAction")
  9.  
  10.  
  11. local cam = workspace.CurrentCamera
  12.  
  13.  
  14. local hrp = script.Parent.HumanoidRootPart
  15.  
  16.  
  17.  
  18. game:GetService("RunService").RenderStepped:Connect(function()
  19.    
  20.    
  21.     script.Parent.Humanoid:MoveTo(hrp.Position + Vector3.new(0, 0, 20))
  22.    
  23.    
  24.     cam.CameraType = Enum.CameraType.Scriptable
  25.    
  26.     cam.CFrame = CFrame.new(hrp.Position - Vector3.new(20, 0, 0), hrp.Position)
  27. end)
  28.  
  29.  
  30.  
  31. local gui = script:WaitForChild("StartGui")
  32. gui.Parent = game.Players.LocalPlayer.PlayerGui
  33.  
  34.  
  35. hrp.Anchored = true
  36. hrp.CFrame = workspace.Obstacles["1"].Start.CFrame * CFrame.Angles(0, 135, 0) + Vector3.new(0, hrp.Size.Y * 1.5, 0)
  37.  
  38. uis.InputBegan:Wait()
  39.  
  40. gui:Destroy()
  41.  
  42. hrp.Anchored = false
Add Comment
Please, Sign In to add comment