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 get this text label for my joke game to change?

the script is in the text label AND it's a local script

game.StarterGui.ScreenGui.TextLabel.Text = ("Jump over the garden wall NOW")
wait(1)
game.StarterGui.ScreenGui.TextLabel.Text = ("IDIOT LOL NOOB XD XD XD")

1 comment

0

StarterGui is a storage location, nothing in there executes. You need to code your scripts so that they reference the copy of the contents that get copied into you Player.PlayerGui. This is normally done by using relative paths (e.g. script.Parent as root in place of game.StarterGui, when the Script prototype is a child of StarterGui)

1 answer

✓ Accepted answer

This is a classic mistake, I made it too. You see, StarterGui is actually a replication Service—or container. Anything within it is actually transferred to another folder called PlayerGui, where the authentic GUIs are actually stored, and updated in real-time.

Trying to address the UI from StarterGui will modify the respective descendant, however, it will not replicate, so for your Script to actually make amendments to the GUI you desire, you need to write this instead: Using a static pathway

local Player = game.Players.LocalPlayer -- PlayerGui resides in the Client
local PlayerGui = Player:WaitForChild("PlayerGui")
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")

ScreenGui.TextLabel.Text = "Hello!"

Using a relative pathway:

local ScreenGui = script:FindFirstAncestorWhichIsA("ScreenGui")
local TextLabel = ScreenGui:FindFirstChildWhichIsA("TextLabel")

TextLabel.Text = "Hello!"

Hope this helped! Remember to accept this answer if so!

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