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

How Would I Do This?

Asked by 9 years ago

How would I see if the Children are greater than a certain number. And if they are do something. I just don't know how to check the children:

function PlayerCount()

    PlayerCount = game.Players:GetChildren()

    for PlayerCountLoop = 1, #PlayerCount do
        leaderstats = (PlayerCount[PlayerCountLoop]:WaitForChild("leaderstats"))

        print(PlayerCount[PlayerCountLoop].Name .. "'s Stats")
        print(leaderstats.Attack.Value.. " - Attack")
        print(leaderstats.Defense.Value.. " - Defense")
        print(leaderstats.Agility.Value.. " - Agility")
        print(leaderstats.Energy.Value.. " - Energy")
        print(leaderstats["Power Level"].Value.. " - Power Level")
    end
end

game.Players.PlayerAdded:connect(PlayerCount)
0
Glad to help :) wjs3456 90 — 9y
0
Now I can carry on with my game :) BosswalrusTheCoder 88 — 9y

1 answer

Log in to vote
1
Answered by
wjs3456 90
9 years ago

I think you could just use an if statement. Try:

if #PlayerCount > 9 then -- Nine is just the example.  Any number can go there
0
Thanks! BosswalrusTheCoder 88 — 9y
Ad

Answer this question