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

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

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago

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!

0
I'm pretty sure you might be right, unless he did something in a localscript. fiddyfiddler 18 — 2y
0
This will work for looping in all servers right? Experol 5 — 2y
Ad

Answer this question