Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LoadScriptsEnv()
- local NPC = script.Parent
- local h = NPC.Humanoid
- local hrp = NPC:WaitForChild("HumanoidRootPart")
- local bf = Instance.new("BodyForce", hrp)
- h:GetPropertyChangedSignal("WalkToPoint"):Connect(function()
- if hrp.Velocity.Magnitude > 30 then
- print(tostring(h.WalkToPoint))
- bf.Force = (h.WalkToPoint - hrp.Position).Unit * 1000
- else
- bf.Force = (h.WalkToPoint - hrp.Position).Unit * math.random(1000, 1200)
- end
- if h.WalkToPoint == nil then
- bf.Force = Vector3.new(0, 0, 0)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement