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

What's up with my script?

Asked by
Relatch 550 Moderation Voter
9 years ago
for test1 = 10, 0, -1 do
    test2 = Instance.new("Hint", Workspace)
    test2.Text = "Intermission (" ..test1.. ")"
    wait(1)
    game.Workspace.Message:remove()
end

if #game.Players:GetChildren() > 2 then
    h = Instance.new("Hint", Workspace)
    h.Text = "Hello, and welcome to MrSmenryBackups' Tournament!"
end

if #game.Players:GetChildren() > 0 then
    h = Instance.new("Hint", Workspace)
    h.Text = "There must be 2 or more players to start!"
end

I don't get any errors, but when 2 people are there, it still says "There must be 2 or more players to start!"

0
Do as ultimate said, except for line 8 make it >= 2 so that if the amount of players is greater than or is 2 the game will start. M39a9am3R 3210 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Line 13 you put:

if #game.Players:GetChildren() > 0 then

That means whenever a player is in a game it will always display "There must be 2 or more players"

To solve this you must use "Else"

Try this:

for test1 = 10, 0, -1 do
    test2 = Instance.new("Hint", Workspace)
    test2.Text = "Intermission (" ..test1.. ")"
    wait(1)
    game.Workspace.Message:remove()
end

if #game.Players:GetChildren() > 2 then
    h = Instance.new("Hint", Workspace)
    h.Text = "Hello, and welcome to MrSmenryBackups' Tournament!"
else
    h = Instance.new("Hint", Workspace)
    h.Text = "There must be 2 or more players to start!"
end

Ad

Answer this question