01 | --> Functions |
02 | ChangeTitle = function (newTitle) |
03 | for i,v in pairs (game.Players:GetChildren()) do |
04 | local toChange = v.PlayerGui:WaitForChild( "GameGUI" ).Title |
05 | toChange.Text = newTitle |
06 | end |
07 | end |
08 | --> Main Game Code |
09 | if #CurrentPlayers > = 2 then |
10 | print ( "More." ) |
11 | ChangeTitle( "Round starting in 30 seconds!" ) |
12 | elseif #CurrentPlayers < 2 then |
13 | print ( "Less." ) |
14 | ChangeTitle( "Waiting for more players!" ) |
15 | end |
Before this, I had an event in Rep where I would call upon from a ServerScript. It was defined in a local-script to take the parameter given upon being called by the ServerScript and to use that to replace the text of the TextLabel.
I'm not understanding what i'm doing wrong here, it seems so simple. But, I have no errors in the console..?
It just won't change the text of the TextLabel.
First of all, are you using a local script?
Secondly, if I am not mistaken, to get the players of the Service players, you can just use :GetPlayers() instead of children.
01 | --> Functions |
02 | ChangeTitle = function (newTitle) |
03 | for i,v in pairs (game.Players:GetPlayers()) do |
04 | local toChange = v.PlayerGui:WaitForChild( "GameGUI" ).Title |
05 | toChange.Text = newTitle |
06 | end |
07 | end |
08 | --> Main Game Code |
09 | if #CurrentPlayers > = 2 then |
10 | print ( "More." ) |
11 | ChangeTitle( "Round starting in 30 seconds!" ) |
12 | elseif #CurrentPlayers < 2 then |
13 | print ( "Less." ) |
14 | ChangeTitle( "Waiting for more players!" ) |
15 | end |
Also, make sure you are looking at output for errors.