Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I change a text?

Let me be more specific.

My script has this variable

local textLabel = game.StarterGui.ScreenGui.TextLabel

but when it runs lines like

textLabel.Text = "Making map,please wait..."

it doesn't work. Am I doing something wrong here?

1 comment

0

game.StarterGui.ScreenGui.TextLabel to game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel

1 answer

✓ Accepted answer

This is because you change the StarterGui's Gui, instead of the player's PlayerGui.

From a localscript you can do this (presuming you have a ScreenGui with default name in StarterGui):

wait()

local LocalPlayer = game.Players.LocalPlayer
local PlayerGui    = LocalPlayer.PlayerGui
local ScreenGui   = PlayerGui:FindFirstChild("ScreenGui")
local TextLabel     = ScreenGui:FindFirstChild("Text");

TextLabel.Text = "Making map, please wait.."


-- Or, if you want it simple;

game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel.Text = "Making map, please wait"


1 comment

0

oh, thank you so much for explaining!

This discussion is preserved as it was. New answers, comments, and votes are closed.