StarterGui is used to give GUIs to the player when the player
either enters the game or spawns or respawns.
Therefore, the only way you would have seen this take
effect is if you resetted your character.
Instead, you should use PlayerGui which is hosted within the player.
Anything you change in a player's PlayerGui will automatically be seen
by said player.
So to apply this, we will go through all the players and
change the text in their textlabel that is located in their
PlayerGui. To do this, we will use a for loop and the GetPlayers method
of game.Players.
function startgame()
wait()
local message = game.StarterGui.ScreenGui.TextLabel
message.Text = "Getting The Game Ready"
for i,v in pairs(game.Players:GetPlayers()) do
local pmessage = game.PlayerGui.ScreenGui.TextLabel
pmessage.Text = "Getting The Game Ready"
end
local model = game.Lighting.Maps
local map = model:GetChildren()[math.random(1, #model:GetChildren())]
wait(1)
for i,v in pairs(game.Players:GetPlayers()) do
local pmessage = game.PlayerGui.ScreenGui.TextLabel
pmessage.Text = map.Name .. " has been chosen as the map!"
end
message.Text = map.Name .. " has been chosen as the map!"
end
startgame()
2 comments
That makes me confused
Basically the other function 'SendMessage' is just a way of writing less code, so instead of having a lot of code that is repeated, I just used this