I’ve literally looked around everywhere. I can’t find a single solution to this. What I am trying to do is find if the player is the chosen player when they die. If they are It turns the chosenPlayer Value to nil.
Heres the code:
connections[player.Name] = player.Character.Humanoid.Died:Connect(function()
table.remove(playersInRound, table.find(playersInRound, player))
table.remove(playerInRoundNames, table.find(playerInRoundNames, player.Name))
if not table.find(playersInRound, ChosenPlayer)then
ChosenPlayer = nil
end
end)
If you’re doing PlayerAdded, all you need to do is:
Player.Character.Humanoid.Died:Connect(function()
The beginning is pointless, unless it’s needed in your code and we can’t see for whatever reason, i.e you not sharing nor wanting to share, or it being non exclusive to the question.
Well it’s best to stick with Player’s name anyways
Here’s why:
You could do both, but you’d need to call the entire variable, “game.Players.Mischiefing”
No, once the humanoid dies the first time the event won’t fire anymore since the humanoid will be reloaded. You need to create a connection every time the character is added.
He uses it in a table to disconnect old connections that are useless.
Stop worrying about the other code, what I’m trying to do is have a chosen player. And there are other players in this round. When this chosen player dies… the round ends, even if other players are still alive.