So I have this script here using the pathfinding service to navigate a NPC to the spawn from a till.
local character = script.Parent
local humanoid = character.Humanoid
character.HumanoidRootPart.Anchored = false
local destination = game.Workspace.NPCSpawner.SpawnPart.Position
local path = PathFindingService:CreatePath()
path:ComputeAsync(character.HumanoidRootPart.Position, destination)
local waypoints = path:GetWaypoints()
for i,v in pairs(waypoints) do
humanoid:MoveTo(v.Position)
humanoid.MoveToFinished:Wait()
end
character:Destroy()
(Not all of it is included as it’s a long script and this is the nessecary part)
However, when the NPC leaves the till it somtimes falls over. There are no blocks there that it can fall over on, there is only one block telling where to go to and cancollide is turned off for that block. Does anyone know how to fix this?