My rig won't respawn after falling out of the world

So this has been a huge problem for me for a long time. Note that what I mean by rig I mean a rig I built and rigged.
Whenever it falls off the baseplate, it never respawns. Here’s the respawn script it’s using, also it’s humanoid is called Enemy

wait(1)
human = script.Parent:findFirstChild("Humanoid")
if human == nil then human = script.Parent:findFirstChild("Enemy") end

if script.Parent.archivable == false then script.Parent.archivable = true end
robo=script.Parent:clone()
robo.Parent = game.Lighting

player = game.Players:playerFromCharacter(script.Parent)
if player ~= nil then robo:findFirstChild(script.Name):remove() end

while true do
	wait(1)
	if human.Health<1 then
		robot=robo:clone()
		robot.Parent=script.Parent.Parent
		robot:makeJoints()
		wait(.1)
		robo:remove()
		script.Parent:remove()
	end
end
		



I’ve looked around for solutions and never had found one.

this line is useless,

unsure if your rig is used as the player’s character, if so, this line is preventing it from working since it’s deleting itself

I suggest changing this line to
if human.Health<1 or not robot.PrimaryPart then
and adding a PrimaryPart to the rig, it may be the humanoid not actually having health set to 0 when dying from the void, this additional check will ensure the primary part exists, if it doesn’t, the enemy probably fell in the void.

1 Like

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