• Bools
    3 replies, posted
Is it possible to count a bool if it equals true or false? I want to count how many players have that bool set to true.
[lua] local playerwithtrue = 0 for k, v in pairs(player.GetAll()) do if v.thingistrue then playerwithtrue = playerwithtrue + 1 end end [/lua]
Alternatively, a more compact syntax would be [lua]totaltrue = v.thing and totaltrue + 1 or totaltrue[/lua]
The idea is to set a bool and then count how many players have the bool set.
Sorry, you need to Log In to post a reply to this thread.