:MoveTo() making my character jittery because I'm using it every task.wait()

hey, does anyone know how to fix my code? this is a script that makes a character follow the closest player, however it’s quite jittery(?) because it’s running on a while loop

while task.wait() do
    for i, character in workspace:GetChildren() do
        if not 
            (character:IsA("Model") and
            character:FindFirstChild("Humanoid") and
            players:GetPlayerFromCharacter(character)
            )
        then
            continue
        end
        
        local char_rootpart = character:WaitForChild("HumanoidRootPart")
        
        if (char_rootpart.Position - abyssal_hrp.Position).Magnitude < max_distance then
            abyssal_humanoid:MoveTo(char_rootpart.Position)
            target = character.Name
            
            print(target)
        end
    end
end

if anyone has any alternative or solutions, please help me out! thank you :))

Use simple path. Lag free path finding. :wink:

Edit: No solution??? :sob::sob::sob:. At least @GamingChris1000 could find a solution lol. :grinning:. GL on your journey.

Also you should always search up on google first. There’s so many of the same threads.

Well you may use simple path as @SilentSuprion mentioned, you can also use RunService.RenderStepped though

what is simple path, is it a module or something?

wouldn’t that be the same as the while loop?
I just tested it out, it still has the same output

Well.then just use simple path. Yes it is a module

1 Like

could you provide me some links please? thank you!

If you google it up roblox simple path shall be fine
https://devforum.roblox.com/t/simplepath-pathfinding-module/1196762

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.