Strange error given on simple code

I am not sure why, but I wrote this simple code here:
image
and I am getting the error “Attempt to compare number < boolean”. Where am I comparing a number to a boolean?! (or am I just not understanding the error)

1 Like

is it because plrcount is a boolean? i think pair loop works on this

for number, player in pairs(game.Players:GetPlayer() do
    if number > 2 then
         print("high")      
   end
end

EDIT: i don’t know if this work i can’t test right now

Try using

if plrcount <= 2 then

And tell me what comes in the output.

I will test it. Give me a moment

Sorry if this seems dumb I haven’t coded in a while lol

plrcount is the number of players.

This definitely won’t work.

Your for loop loops through all players individually.

Enclose playercount > 2 in brackets

local plrcount = #game.Players:GetPlayers()
if not (plrcount > 2) then
2 Likes

Testing it right now. Give a moment

This works thank you very much

1 Like

Honestly i had no idea why it wasn’t working for him but i think RIGHTEOUS got the answer

1 Like

Its okay I fixed it. And yeah I forgot I could do that its been too long since I have coded

Took a long break from it for some reason