Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Check if the folder is empty?

Hello fellow users, today I tried to make a folder check for my round system, everything works fine but I wan't to do when every player dies the game endes, and I tried those scripts:

local rep = game:GetService("ReplicatedStorage")
local playerInGames = rep.PlayersInGame
local matchRunning = rep.Variables:WaitForChild("matchRunning")

if playerInGames < 1 and matchRunning.Value == true then
		print"game ended, all players died."
end

I tried this also:

function isEmpty(t)
    return next(t) ~= nil
end

The first try gave the error: "attempt to compare Instance and number "

Please help xD, Have a nice day!

1 answer

You can try

if playerInGames:GetChildren == nil then

2 comments

0

didn't work, i did a print to check and it said it was with things inside when clearly wasn't

0

Then try #playerInGames:GetChildren() == 0 

This discussion is preserved as it was. New answers, comments, and votes are closed.