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 edit a Textlabel in PlayerGUI?

How do I edit a Textlabel in PlayerGUI?

The File Path is

game Players [Player] PlayerGui ScreenGui TextLabel.Text

Didn't work previously. Please help.

2 answers

✓ Accepted answer

For Guis use a Local script, only local scripts work for Guis

Example code:

local player = game:GetService("Players").LocalPlayer
local PlayerGui = player.PlayerGui
PlayerGui.ScreenGui.TextLabel.Text = "Text here..."

What happened?

Well in your case you showed NO code so I will explain completely, 1st I grabbed the player and named him "player" (line 1) then I got the PlayerGui and named it "PlayerGui" (line 2) to brake down the code, on line three, I got the Text within the TextLabel and changed it to Text here...

I'm not the best at explaining but I hope this helps!

Thank you for accepting! Hope this helped!

1 comment

0

Fair play WideSteal, I will rise one day:)

It's best you break your Code down, trying to access something directly that far into an Instance may have chances of returning nil. It's best to format it like so

local Player = game:GetService("Players").LocalPlayer --// Get's access to *your* player
local PlayerGUI = Player:WaitForChild("PlayerGui") --// Get's access to *your* GUI

local GUI = PlayerGUI:WaitForChild("ScreenGui").TextLabel --// Reference the TextLable

Gui.Text = "Hello World!" --// Change Text

Be aware that GUI related Scripts should be handled by LocalScripts, usually as a descendant of the GUIObject.

Don't forget!! When working with a Player's GUI, you must manipulate it from their PlayerGui, not StarterGui, that is the Server-side view of the UI, as of FE restrictions. Your screen will do nothing if you try from here.

Hope this helps!

(If there is anything you'd like clarification on or questions, please comment!)

1 comment

0

ay no editing ur late

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