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

How Would I Do This?

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)

2 comments

0

Glad to help :)

0

Now I can carry on with my game :)

1 answer

✓ Accepted answer

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

if #PlayerCount > 9 then -- Nine is just the example.  Any number can go there

1 comment

0

Thanks!

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