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

Why my character doesn't respawn?

i put death animation to the game character and doesn't respawn (sorry for my bad english)

script.Parent.dechanimeichion.OnServerEvent:Connect(function(_, anim, humanoid, char, root)
	humanoid:LoadAnimation(anim):Play()
	root.Anchored = true
end)
--anim = the death animation
--humanoid = the humanoid from the character
--char = the character
--root = HumanoidRootPart from the character

https://www.youtube.com/watch?v=CtltNSmxwqI

1 comment

0

Add the LoadCharacter() as that person's answer said, but also play the animation in the LocalScript. Animations meant for players should be played by a LocalScript while animations for NPCs should be played by a normal script.

1 answer

✓ Accepted answer

You have to use :LoadCharacter() wich can respawn the player, this is a method from Player object, also to make good questions make them more descriptive.


script.Parent.dechanimeichion.OnServerEvent:Connect(function(plr, anim, humanoid, char, root)
    humanoid:LoadAnimation(anim):Play()
local animationTrack = humanoid:LoadAnimation(anim) -- Get the animation Track
local Delay= animationTrack.Length -- get the length
    root.Anchored = true
wait(Delay) -- wait the animation to be completed
plr:LoadCharacter()
end)

Mark this as answered if this answered your question!

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