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

How do I change a text?

Asked by 6 years ago

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?

0
`game.StarterGui.ScreenGui.TextLabel` to `game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel` arshad145 392 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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"


0
oh, thank you so much for explaining! GIassWindows 141 — 6y
Ad

Answer this question