RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Optimize the :MoveTo function on a humanoid so it stops lagging the server."
-- server script local humanoid = script.Parent.Humanoid local speed = 16 local function moveTo(position) local path = game.PathfindingService:CreatePath() path:ComputeAsync(humanoid.Position, position) for _, waypoint in pairs(path:GetWaypoints()) do humanoid:MoveTo(waypoint.Position, speed) humanoid.MoveToFinished:Wait() end end humanoid.MoveTo:Connect(moveTo)