My npc was able to move but for some reason it stopped working

I want my npc to move from where it stands, and to move to a part,

But for some reason it stopped working I made it work, then for some reason it randomly stopped. idk why but any tips on why that would be ?

I tried looking up yt videos and looking up how to fix the issue but so far nothing worked, I’m kinda new to scripting so maybe that’s the reason but I tried for hours and couldn’t find anything.

here’s the part where it makes it move (and yes the john is the npc and its r6 and it has all the parts it needs to work)
and if you need more info, it just doesn’t go to the part and its just a straight path to the part with nothing in the way. and it is all unanchored. and it doesn’t show any errors.

code:
local PathFind = game:GetService(“PathfindingService”)

	local JohnHumanoid = workspace.John:WaitForChild("Humanoid")
	local JohnTorso = workspace.John:WaitForChild("Torso")
	
	local path = PathFind:CreatePath()
	
	local waypoints = path:GetWaypoints()
	
	path:ComputeAsync (JohnTorso.Position, workspace.STSLCS:WaitForChild("StarlightTownCutScene1").MovePart.Position)
	
	for i, waypoint in pairs(waypoints) do
		JohnHumanoid:MoveTo(waypoint.Position)
		JohnHumanoid.MoveToFinished:Wait(0.1)
	end
	
	JohnHumanoid:MoveTo(workspace.STSLCS:WaitForChild("StarlightTownCutScene1").MovePart.Position)

any tips or the reason why it doesn’t work any more would be helpful thanks in advance.

Nvm I found the issue and how to fix it I was looking at the problem differently I needed to put the npc into replicated first then clone it in a local script to workspace heres the code to fix it if anyone had the same problem as me:

game.ReplicatedFirst.John:Clone().Parent = workspace

I knew it would be something small like that but I looked at it wrong

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.