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

Whats wrong with my blinking text GUI script that runs on < 3 players?

Asked by 9 years ago
while true do 
    if game.Players.NumPlayers< 3 then 
        script.Parent.Visible = true 
        wait(.5) 
        script.Parent.Visible = false 
    elseif game.Players.NumPlayers>= 3 then 
        script.Parent.Visible = false 
    end 
end

Please fix this! Thanks! It does not work for me!

1 answer

Log in to vote
3
Answered by
Merely 2122 Moderation Voter Community Moderator
9 years ago

Your code is in a while loop, so here's the order things will happen if the number of players is less than 3:

script.Parent.Visible = true
wait(.5)
 script.Parent.Visible = false
--immediately it goes back to the start of the loop, setting script.Parent.Visible = true

You need to add a wait(0.5) after script.Parent.Visible = false, because otherwise the loop restarts and it immediately sets script.Parent.Visible = true

Ad

Answer this question