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

why does my respawn script only work SOMETIMES, but other times it doesn't, why?

Asked by
0msh 333 Moderation Voter
6 years ago

so my respawn script only works sometimes, and some times its completely broken. When it's broken, the "Human" (I changed the name to Human instead of Humanoid) make joints, the torso will float in air with head on top, and other parts just fall into nowhere... I only have: -Head, LArm,RArm,LLeg,RLeg,Torso -Humanoid -a respawn script and another script that doesn't affect the respawning of the NPC at all inside of the NPC

my respawn script:

npc = script.Parent:Clone()

function Died()
    wait(10)
    npc.Parent = script.Parent.Parent
    npc:MakeJoints()
    npc.Human.Health = npc.Human.MaxHealth
    script.Parent:Remove()
end

script.Parent.Human.Died:connect(Died)

I do not have HumanoidRootPart, I don't know if it have any effect on MakeJoints()...?

1 answer

Log in to vote
0
Answered by 6 years ago

I had the same issue and I just put the MakeJoints first. Try it and see if it works for you as well.

function Died()
    wait(10)
    npc:MakeJoints()
    npc.Parent = script.Parent.Parent
    npc.Human.Health = npc.Human.MaxHealth
    script.Parent:Remove()
end

script.Parent.Human.Died:connect(Died)

Ad

Answer this question