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
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
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.
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
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
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.
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.
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
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
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
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
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