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

The script won't change the text twice?

Asked by 8 years ago

It only changes one, and when I put a print, it works, but it doesn't change the text.

local label = game.StarterGui.waitGui.waitFrame.waitLabel

game.Players.PlayerAdded:connect(function(plr)
    label.Text = "Welcome, "..plr.Name..", to WIP, an unfinshed game."
    wait(2)
    --if I put print here, the print works, but still doesn't change the text.
    label.Text = "0"
end)

1 answer

Log in to vote
3
Answered by
Azmidium 388 Moderation Voter
8 years ago

You are modifying the StarterGui which isn't gonna change the player view, but the servers view. You need to do this:

1) move the variable to where it can be changed to the players PlayerGui.

2) Modify, after the player is loaded

Basically this:

game.Players.PlayerAdded:connect(function(plr)
    repeat wait() until plr:WaitForChild("PlayerGui") -- This waits for the GUI's for the player to load
    local label = plr.PlayerGui.StarterGui.waitGui.waitFrame.waitLabel  -- This goes into the PlayerGui and modifies his view
    label.Text = "Welcome, "..plr.Name..", to WIP, an unfinshed game."
    wait(2)
    label.Text = "0"
end)
0
Thank you. SimplyRekt 413 — 8y
Ad

Answer this question