Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this NPC dying when I command it to move to a certain location?

This code clones an NPC from Lighting and drops it into the Workspace so it can be moved, however it dies immediately.

az = game.Lighting.WalkOut:Clone()
az.Parent = game.Workspace
game.Workspace.WalkOut.PrimaryPart = game.Workspace.WalkOut.Torso
for gha = 156, 143, -1 do
	wait()
	game.Workspace.WalkOut:MoveTo(Vector3.new(gha, 4, -1))
end
for ghb = -1, 4, 1 do
	wait()
	game.Workspace.WalkOut:MoveTo(Vector3.new(143, 4, ghb))
end

1 answer

✓ Accepted answer

Whenever you move the NPC, the joints are lost. So you simply need to add

NPC:MakeJoints()

In order to make new joints and keep it from dying

2 comments

0

I mean when you move the NPC from the lighting to workspace, not when you use MoveTo

0

This works, thank you. But the character isn't moving with the animation and none of the hats on the character have loaded, how is this fixed?

This discussion is preserved as it was. New answers, comments, and votes are closed.