Skip to content

Instantly share code, notes, and snippets.

View metricrb's full-sized avatar

michael metricrb

View GitHub Profile
@metricrb
metricrb / Pathfinding.client.lua
Last active May 10, 2026 22:00
Resolving the MoveToFinished event delay in Character Pathfinding by implementing new logic using RunService.RenderStepped
--[[
When we call Humanoid:MoveTo() from waypoint to waypoint, and use the MoveToFinished event to detect when the
character reaches each waypoint it does work. However unlike the demo place and code portrayed in the documentation
on Character Pathfinding, many games will not operate with smoothness due to the event having a delay on being communicated,
leaving a stuttering NPC between nodes and overall a poor visual effect.
This is detrimental on considering performance in public games, unlike test baseplates with minimal events and memory.
To resolve this issue, I implemented a snippet of ClickToMoveController under Player > PlayerScripts > PlayerModule > ControlModule.
You should notice that ClickToMove controller does not register for MoveToFinished but instead uses its own logic to decide when to move