Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Humanoid:MoveTo movements are not working right?

Asked by 2 years ago
Edited 2 years ago

Hello, I am making 15-20 NPCs walk randomly between points. But, after a few seconds, the movements get less smooth and jittery.

Video

Code

for i, point in pairs(waypoints) do
        script.Parent:MoveTo(point.Position + Vector3.new(0,3,0))
        local move = false
        script.Parent.MoveToFinished:Connect(function()
            move = true
        end)
        script.Parent.MoveToFinished:Wait()
    end

Any help is appreciated thanks

0
Consider using Humanoid.WalkToPoint instead. itznbur21_YT 0 — 2y
0
Since you are already waiting for the event to fire on line 7, connecting to the event is kinda redundant. appxritixn 2235 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

I found a workaround. If you set the waypoint distance to a higher number, and you use a line of code to wait just before the NPC gets to the destination, some stuttering happens but it is very minimal.

Ad

Answer this question