RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make me an working npc that walk random"
-- server script local npc = game.Workspace.NPC local pfs = game:GetService("PathfindingService") while true do local randomX = math.random(-100, 100) local randomZ = math.random(-100, 100) local randomPosition = Vector3.new(randomX, 0, randomZ) local path = pfs:CreatePath() path:ComputeAsync(npc.HumanoidRootPart.Position, randomPosition) for _, waypoint in pairs(path:GetWaypoints()) do npc.Humanoid:MoveTo(waypoint.Position) npc.Humanoid.MoveToFinished:Wait() end end