How to check if all players are dead in the folder but not the tiger?

So what I want to do in the players folder there are values of players that are set to dead once they die but how would I check if all are dead but not the tiger I get the tiger by using the username of the player and checking it’s character name which is Tiger1 so I know that’s the tiger but how would that work?

for _, player in pairs(game.ReplicatedStorage.RoundInfo.Players:GetChildren()) do
	if all are dead but not the tiger then
		playerModule.showAllCutscene(game.ReplicatedStorage.ChapterValues.CutsceneChapter.Value, "Outro")
		game.ReplicatedStorage.RoundInfo.Timer.Value = 0
		game.ReplicatedStorage.RoundInfo.Status.Value = ""
	end
end
5 Likes

would this work?

for _, player in pairs(game.ReplicatedStorage.RoundInfo.Players:GetChildren()) do
	local tiger = game.Players[player.Name]
	local tigercharacter = tiger.Character
	local playervalue = player.Value
	if playervalue == "Dead" and tigercharacter.Name == "Tiger1"  then
		playerModule.showAllCutscene(game.ReplicatedStorage.ChapterValues.CutsceneChapter.Value, "Outro")
		game.ReplicatedStorage.RoundInfo.Timer.Value = 0
		game.ReplicatedStorage.RoundInfo.Status.Value = ""
	end
end

4 Likes

Died event will not work unless the character is in workspace.
You can use:

for _, player in pairs(game.ReplicatedStorage.RoundInfo.Players:GetChildren()) do
	local tiger = game.Players[player.Name]
	local tigercharacter = tiger.Character
	local playervalue = player.Value
	
   tigercharacter.Humanoid.Died:Connect(function()
        playerModule.showAllCutscene(game.ReplicatedStorage.ChapterValues.CutsceneChapter.Value, "Outro")
		game.ReplicatedStorage.RoundInfo.Timer.Value = 0
		game.ReplicatedStorage.RoundInfo.Status.Value = ""
	end)
end

I don’t know what is playermodule if its your module then its okay if its player module then I will tell you it’s client sided.

3 Likes

I am not talking about died I am talking about the players folder in the roundinfo folder in this folder are string values that determine death or alive or escaped or secret ending what I want to check if all players are dead or escaped or have archived the secret ending which you can check about the value

The playerModule is my own module for cutscenes!

I am not talking about the died event!

1 Like

wouldn’t you be setting all the players to tiger with that script?

Also is each of the value a singular value for all players or does each player have a value? if each player has a value, you probably want to merge them into a singular value instead. After that, use value.Changed and check if the value has reached its maximum, in which case you could call the playerModule thingie

2 Likes

each player has a own value, to dermine if they are alive dead or the other two things!

2 Likes

also why are you using string values?

A good setup would be having a “alive” int value and an “escaped” int value. If you have a secret ending you could also have that as either an int value or a boolean value depending on if all/most players need to get it or if only one player needs to get it.

Connect all 2 (or 3) values with .Changed and check to see if:
alive == 0
escaped == player count
secret == however much players you want.

In which case you could find out what you want

2 Likes

I think I will just do a folder for the tiger where I put the tiger value in and then check if the players value are dead or secret ending or escaped!

2 Likes

also remember to decrease “alive” by one upon player’s death or leaving (and when player escapes), and increase escaped by one if the player escapes. Depending on how the secret value is activated, toggle it or increase it by one when the player activates it.

And to check if the tiger has died, you could always just connect the tiger to a Humanoid.Died event which would disconnect all previous events and then activate whatever happens when the tiger dies.

2 Likes

I am slightly confused on what you mean. Can you please rephrase the question again?

Are you asking for how to handle the player dying or are you asking for how to do something with the tiger? (Or both?)

2 Likes

I will make a folder for the tiger where the tiger is located and then will check if all players in the player folder are dead,escaped or archived the secret ending

Likethis

1 Like

There’s a problem here you check if character name is tiger1 changing character name isn’t good and if you didn’t then you shouldn’t check character name

2 Likes

I am morphing the players so the character name changes automaticcly and also I don`t think it is bad if you change it!

2 Likes

also I am having a starter Character!

2 Likes

all the players in the… player folder? do you mean values, or are you literally moving the player object into the folder? if so, dont do that. Moving the player object outside of game.players kicks the player

1 Like

add a attribute in player isTiger and name the startercharacter to playername and then change if chrarcter.name == “Tiger1” to if tiger:GetAttribute(“IsTiger”) == true

1 Like

this is way better than changing the character name to tiger so it will be easy to deal with.

1 Like

nah it’s a values a string values I think

2 Likes

even better way is to just use a variable named “tiger” and store the player object of the tiger in it lol

1 Like

tbh there’s a better system and it’s creating values or attributes which are boolean:
IsTiger;
IsEscaped
IsKilled
IsSecretEndingAchieved

and deal with it via scripting

for _, Player in game.Players:GetPlayers() do
      if Player:GetAttribute("IsKilled") == true then
      
       elseif Player:GetAttribute("IsEscaped") == true then
        
       elseif Player:GetAttribute("IsSecretEndingAchieved") == true then

       end
end
4 Likes