RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"the npc is running sideways"
-- server script local pfs = game:GetService("PathfindingService") local npc = script.Parent local door = game.Workspace.Door -- define the door local ramp1 = game.Workspace.Ramp1 -- define the first ramp local ramp2 = game.Workspace.Ramp2 -- define the second ramp local runService = game:GetService("RunService") -- Function to move to a target local function moveToTarget(target) local path = pfs:CreatePath() path:ComputeAsync(npc.HumanoidRootPart.Position, target.Position) for _, waypoint in pairs(path:GetWaypoints()) do if waypoint.Action == Enum.PathWaypointAction.Jump then npc.Humanoid.Jump = true end npc.Humanoid:MoveTo(waypoint.Position) npc.Humanoid.MoveToFinished:Wait() end end -- Start the NPC's behavior runService.Stepped:Connect(function() npc.Humanoid.WalkSpeed = 16 -- increase the NPC's speed npc.Humanoid.AutoRotate = false -- disable auto rotation moveToTarget(ramp1) -- move to the first ramp moveToTarget(ramp2) -- move to the second ramp moveToTarget(door) -- finally move to the door end)