Workspace Script
This is a npc walking script between 2 blocks, and the error occurs when the npc dies and he respawn, this script stops working. so how do i fix this error? I'm going to put the respawn script, and the walking script, for you can help me.
ScreenshotRoblox1 ScreenshotRoblox2
Code
--[[
1. Put this script inside the button
2. Rename the modelname
3. The model must be a child of Workspace
--]]
button = script.Parent
modelname = "Judoon" -- Model name
model = game.Workspace:FindFirstChild(modelname)
local NPC = model -- Name Npc Here
model = nil
while true do
wait()
NPC.Humanoid:MoveTo(script.Parent.JudoonWallX.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.JudoonWallZ.Position)
NPC.Humanoid.MoveToFinished:wait()
end

2 comments
Try putting the script that moves him, inside of his model and have it run from there instead of trying to find him
Thank you very much, I managed to do it.