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

when testing for 2 players, the code doesn't work but only for 1 player?

for the < works but not for the >

if #Players < 2 then
	Wall.Back.Req.Cost.Text = "Needed 2"
	Wall.Back.TextLabel.Text = "2 people are required"
	
	Wall.Front.Req.Cost.Text = "Needed 2"
	Wall.Front.TextLabel.Text = "2 people are required"
end

if #Players > 2 then
	Wall.Back.Req.Cost.Text = "1:00"
	Wall.Back.TextLabel.Text = "Round Timer!"
	Wall.Back.TextLabel.TextColor3 = Color3.new(0, 1, 0)
	
	Wall.Front.Req.Cost.Text = "1:00"
	Wall.Front.TextLabel.Text = "Round Timer!"
	Wall.Front.TextLabel.TextColor3 = Color3.new(0, 1, 0)
end

1 answer

I think your problem is that you're checking for greater than 2 players and you're only testing with 2 players. All you need to do is change line 9 so that it allows 2 OR more players like so:

if #Players < 2 then
    Wall.Back.Req.Cost.Text = "Needed 2"
    Wall.Back.TextLabel.Text = "2 people are required"

    Wall.Front.Req.Cost.Text = "Needed 2"
    Wall.Front.TextLabel.Text = "2 people are required"
end

if #Players >= 2 then
    Wall.Back.Req.Cost.Text = "1:00"
    Wall.Back.TextLabel.Text = "Round Timer!"
    Wall.Back.TextLabel.TextColor3 = Color3.new(0, 1, 0)

    Wall.Front.Req.Cost.Text = "1:00"
    Wall.Front.TextLabel.Text = "Round Timer!"
    Wall.Front.TextLabel.TextColor3 = Color3.new(0, 1, 0)
end

Hope that helps!

2 comments

0

I'm pretty sure you might be right, unless he did something in a localscript.

0

This will work for looping in all servers right?

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