Hello, I am working on a game that has a round system, and at the beginning of the round, I assign each player a value. When a player dies during a round/when the round ends, their value is removed.

I'm trying to determine when all players die during a round, but I just receive an error, and I'm not quite sure why.

Here is my code:

elseif #PlayersAlive:GetChildren() == 0 then
		
		print "All players dead!"
		
		break
		
end

NOTE: PlayersAlive is the folder that stores all of the values. Thanks for any help.

6 comments

0

what error?

0

That Player1 is not a valid member of Folder.

0

In that case, the part of your script you posted is not what's causing the error.

0

Do you need anymore info? Like I said, all I'm trying to do is to determine when a folder is empty. It works with removing a dead player.

0

You should just use a table of who is alive and remove them when they die in the round not a value holder in a folder.

0

Again, it's still been working up until now, all I want to know is how to detect if a folder is empty.