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

How would you make player death animations?

Hey guys! I was just wondering how you would accomplish making death effects/animations on Roblox. For example, in the game 'Murder Mystery', the player becomes a "skeleton" when they die, and in 'Deathrun 2' players can choose from a choice of five different death effects/animations. Can someone teach me how this is done? I am not asking for an entire script. It would be very helpful if someone could just teach me the basics and explain its general concept. Thank you!

2 answers

✓ Accepted answer

Put this in the script

function OnEntered(Player)
	while Player.Character == nil do -- Notice it does not use break.
		wait()
	end
	wait(1)
	Player.Changed:connect(function(Property)
		if Property == "Character" then
			if Player.Character then
				local Mods = script:GetChildren()
				for X = 1, # Mods do
					if Mods[X].className == "Script" or Mods[X].className == "LocalScript" then
						local S = Mods[X]:Clone()
						S.Disabled = false
						S.Parent = Player.Character
					end
				end
			end
		end
	end)
	local Mods = script:GetChildren()
	for X = 1, # Mods do
		if Mods[X].className == "Script" or Mods[X].className == "LocalScript" then
			local S = Mods[X]:Clone()
			S.Disabled = false
			S.Parent = Player.Character
		end
	end
end
game.Players.ChildAdded:connect(OnEntered)

Now insert a script into this script and put

Character = script.Parent
Humanoid = Character.Humanoid
Torso = Character.Torso
if Character.Name == "Player1" or Character.Name == "NameHere" or Character.Name == "NameHere" then
function OnDeath()
	print(Character.Name .." has died")
	H = Instance.new("Hint", Workspace)
	H.Text = Character.Name .." Has died"
	wait(3)
	H:Destroy()
	X = Instance.new("Explosion", Character)
	X.Position = Character.Torso
	X.BlastRadius = 100 --Change this to how many studs/whatever to who dies Max: 100
	X.BlastPressure = 2500 --Set to super SUPER high if you want to ff kill players
	end
end
Humanoid.Died:connect(OnDeath)

I made that explode the player when they die

4 comments

0

Wait remove the "if" Character.Name == "Player1" or and so.... then remove last end if you want it to do for everyone

0

Oh, i see how it works. Thank you for the example!

0

No problem!

0

If you want I can also me putrify, and make the character burst into flames of course that would lag if I made them too big.

You would make an animation, and then a .Changed event would check to see if the human's health equals zero. If so, run animation.

3 comments

1

also Humanoid.Died

0

Yeah. That would work to. I always have to do things the hard way c:

0

Can you show me how I'd use humanoid.Died? Does it have to be put with PlayerAdded?

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