Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

NPC walking why error occured stopped?

Asked by 4 years ago
Edited 4 years ago

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

0
Try putting the script that moves him, inside of his model and have it run from there instead of trying to find him MrLonely1221 701 — 4y
0
Thank you very much, I managed to do it. darkeyescr 7 — 4y

Answer this question