Advertisement
gamesreboot

Acceleration

Jul 12th, 2022 (edited)
579
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. LoadScriptsEnv()
  2. local NPC = script.Parent
  3. local h = NPC.Humanoid
  4. local hrp = NPC:WaitForChild("HumanoidRootPart")
  5. local bf = Instance.new("BodyForce", hrp)
  6.  
  7. h:GetPropertyChangedSignal("WalkToPoint"):Connect(function()
  8.     if hrp.Velocity.Magnitude > 30 then
  9.     print(tostring(h.WalkToPoint))
  10.         bf.Force = (h.WalkToPoint - hrp.Position).Unit * 1000
  11.     else
  12.         bf.Force = (h.WalkToPoint - hrp.Position).Unit * math.random(1000, 1200)
  13.     end
  14.     if h.WalkToPoint == nil then
  15.         bf.Force = Vector3.new(0, 0, 0)
  16.     end
  17. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement