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!
Put this in the script
01 | function OnEntered(Player) |
02 | while Player.Character = = nil do -- Notice it does not use break. |
03 | wait() |
04 | end |
05 | wait( 1 ) |
06 | Player.Changed:connect( function (Property) |
07 | if Property = = "Character" then |
08 | if Player.Character then |
09 | local Mods = script:GetChildren() |
10 | for X = 1 , # Mods do |
11 | if Mods [ X ] .className = = "Script" or Mods [ X ] .className = = "LocalScript" then |
12 | local S = Mods [ X ] :Clone() |
13 | S.Disabled = false |
14 | S.Parent = Player.Character |
15 | end |
Now insert a script into this script and put
01 | Character = script.Parent |
02 | Humanoid = Character.Humanoid |
03 | Torso = Character.Torso |
04 | if Character.Name = = "Player1" or Character.Name = = "NameHere" or Character.Name = = "NameHere" then |
05 | function OnDeath() |
06 | print (Character.Name .. " has died" ) |
07 | H = Instance.new( "Hint" , Workspace) |
08 | H.Text = Character.Name .. " Has died" |
09 | wait( 3 ) |
10 | H:Destroy() |
11 | X = Instance.new( "Explosion" , Character) |
12 | X.Position = Character.Torso |
13 | X.BlastRadius = 100 --Change this to how many studs/whatever to who dies Max: 100 |
14 | X.BlastPressure = 2500 --Set to super SUPER high if you want to ff kill players |
15 | end |
16 | end |
17 | Humanoid.Died:connect(OnDeath) |
I made that explode the player when they die
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.