Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Check if the folder is empty?

Asked by 3 years ago

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

Log in to vote
1
Answered by 3 years ago

You can try

if playerInGames:GetChildren == nil then
0
didn't work, i did a print to check and it said it was with things inside when clearly wasn't LyricalFrog3 45 — 3y
0
Then try #playerInGames:GetChildren() == 0  LeedleLeeRocket 1257 — 3y
Ad

Answer this question