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

Why do my NPCs keep dying?

Hey guys, here's my script.

while true do
	shed = game.ServerStorage.Shedletsky:Clone()
	shed.Parent = game.Workspace
	shed:MoveTo(Vector3.new(math.random(-512,512), math.random(50,325), math.random(-512,512)))	
	--game:GetService("Debris"):AddItem(shed, 5)
	wait(1)
end

Things are pretty straight-forward, except Shedletsky keeps dying when I move him. i don't get any errors. You can test this by inserting a NPC with a humanoid into ServerStorage and naming it Shedletsky.

1 answer

You need to use :MakeJoints() to keep the character together:

while true do
    shed = game.ServerStorage.Shedletsky:Clone()
    shed.Parent = game.Workspace
    shed:MakeJoints()
    shed:MoveTo(Vector3.new(math.random(-512,512), math.random(50,325), math.random(-512,512))) 
    --game:GetService("Debris"):AddItem(shed, 5)
    wait(1)
end

2 comments

0

Thank you!

0

No problem.

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