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

How do I edit a Textlabel in PlayerGUI?

Asked by 6 years ago

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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!

0
Fair play WideSteal, I will rise one day:) Ziffixture 6913 — 6y
Ad
Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

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!)

0
ay no editing ur late WideSteal321 773 — 6y

Answer this question