Answered by
7 years ago Edited 7 years ago
Your problem could be in several factors.
How do you check if the player's health is less that 0? If your using
1 | if humanoid.Health = = 0 then whatever end |
then you are doing it wrong. You need
1 | if humanoid.Health < = 0 then whatever end |
However, I doupt that this is your problem. Now, I bet you damage the players via the following method:
1 | humanoid.Health = humanoid.Health - 20 ( or whatever the damage is) end |
While this is not wrong, it is also possible to do it via the :TakeDamage()
function. your script would look like this:
2 | humanoid:TakeDamage(damage) |
Lastly, if all else fails, I have only one idea of what to do. Check it the player has <= 0 health, and then call the :LoadCharacter()
function on their player (not character). Your script would look like this: (LocalScript inside StarterPlayerScripts)
01 | local player = game.Players.LocalPlayer |
03 | while true do wait( 0.1 ) |
04 | if player.Character ~ = nil then |
05 | local humanoid = player.Character:FindFirstChild( 'Humanoid' ) |
06 | if humanoid ~ = nil then |
07 | if humanoid.Health < = 0 then |
08 | humanoid:TakeDamage( math.huge ()) |
09 | player:LoadCharacter() |
Accept if helped thx