So I'm making a survival horror game and I need it so it can somehow know if a player has escaped to a player being killed. The script checking if there are no players in a team is below. Please help!
if #teamplayers == 0 then
for _, v in pairs(game.Players:GetChildren()) do
if v.TeamColor == BrickColor.new("Carnation pink") then
v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + 100
v.CharacterAppearanceId = v.UserId
v.TeamColor = BrickColor.new("White")
v.CharacterAppearanceId = v.UserId
print("eeeee")
game.ReplicatedStorage.ESallyhasWon:FireAllClients()
wait(3)
script.CountDown.Value = 0
end
end
end

6 comments
any output errors?
There's nothing wrong with the script. I just need ideas on how it would work. What I mean is I need the script to somehow know between a player dying and a player escaping.
So if you're wanting to separate players in any way, I'd would either use a set of tables to store the different playerstates or use CollectionService to tag players.
Thanks! I'll definitely try using tables.
Well, is it possible for tables to be in modulescripts so multiple scripts can access it?
Maybe you could make a title related to the script, not the game though.