how would i record if a player died in a game round or not? i've lost my attempt to this due to studio issues.
how would i record if a player died in a game round or not?
2 answers
Make a bool that sets to true when the round has started then use the plr.Humanoid.died() function. Once the player dies say if bool == true then to confirm a round is in session.
Wiki: http://wiki.roblox.com/index.php?title=API:Class/Humanoid/Died
-- example
bool = false
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(chr)
function roundstart()
if bool == false then
bool = true
end
wait(90) -- 1.5 mins
-- do whatever else
end
function roundend()
if bool == true then
bool = false
end
wait(30)
-- do whatever else
end
for i=1, math.huge() do
roundstart()
wait()
roundend()
end
chr.Humanoid.Died:connect(function(player)
if bool == true then
('ey')
end
end)
end)
end)
- I kinda just wrote that on ze fly so it may be incorrect in some parts
1 comment
if u need to do something to verify whether they r in the match use a 'ready for match' gui and a bool value (object not made in the script) in the player in players which is true if they click ready for match. - bools save the day. - remember to use bools to debug fam.
What I would do is insert something into the player, such as a value. Once the players health => 0, then you make the value 1 or something. Check at the end of the game everyone's tags. If you a player has a 2 value, then the were still alive. If the value is 1, then they died. Just a suggestion, but I'm looking into it.
1 comment
alright
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
There's a Died event to humanoids.
@M39a9am3R thanks, i'll look into that.