Death Script: Don't Respawn automatically. Press button to respawn. Can I get help?
Hello! I am attempting to make an RP game for my Roleplay community and want to make a script we would refer to as a Death Script. Basically when you die you will go into a ragdoll then if you press 'R' it will respawn and 'E' will revive (Spawn you where you died). Please could I get help if it is possible. I have a ragdoll script when you die but I would prefer it to be in the same script. So far I have:
01 | local mouse = game.Players.LocalPlayer:GetMouse() |
03 | game.Players.CharacterAutoLoads = false |
05 | game.Players.PlayerAdded:connect( function (player) |
06 | player.CharacterAdded:connect( function (character) |
07 | local humanoid = character:FindFirstChild( "Humanoid" ) |
09 | humanoid.Died:connect( function () |
10 | mouse.KeyDown:connect( function (key) |
11 | key = string.lower(key) |
12 | if string.byte(key) = = "r" then |
13 | player.LoadCharacter() |
19 | player.LoadCharacter() |
The script I started with was one I found on the Wiki which delays the respawn.
03 | game.Players.CharacterAutoLoads = false |
05 | game.Players.PlayerAdded:connect( function (player) |
06 | player.CharacterAdded:connect( function (character) |
08 | local humanoid = character:FindFirstChild( "Humanoid" ) |
10 | humanoid.Died:connect( function () |
12 | player:LoadCharacter() |
16 | player:LoadCharacter() |
The problem with the edited script I am having is it respawns you after 5 seconds automatically. I also dont have a revive in it yet.
Many Thanks.
Ethan