Could someone guide me into how to make a script that would detect when all player died in a minigame and then find the last player standing? I would have used a value and once they died make the value true but that would not sit right with exploiters. Thanks!
COMMUNITY QUESTION
How to detect when all players have died?
1 answer
You can still use value you just need to code them so that the value cannot change.
e.g. locking the value with a changed event:-
local boolValue = Instance.new('BoolValue', game.Workspace)
boolValue.Name = 'test'
boolValue.Value = false
boolValue.Changed:connect(function()
boolValue.Value = true -- this will lock to true once it is set
end)
print('current value', boolValue.Value)
boolValue.Value = true
print('current value', boolValue.Value)
This will make it impossible to change the value back to false.
There are other methods such as storing the players in a table then remove them once they die.
Hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.
