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

How do I change the text of this text label?

Asked by 5 years ago
game.Players.PlayerAdded:Connect(function(plr)
    wait(1)
    game.StarterGui.StarterGui.PlayerName.Text = game.Players.LocalPlayer.Character.Name
end)

I've tried so many different things to change it, but it never worked. I'm using a local script because I'm trying to make a loading screen GUI kind of.

0
And where did you put the LocalScript? Also, I don't think using PlayerAdded event in a LocalScript is a good way to do. Afterl1ght 321 — 5y
0
I put it under the gui. iiBuilder_Boy 27 — 5y
0
I'm not quite sure you can change startergui... Hm.. veljkov007 0 — 5y
0
Make a remote event. User#25281 0 — 5y

3 answers

Log in to vote
0
Answered by
zuup123 99
5 years ago
Edited 5 years ago

Try puting this local script in your screengui:

local player = game.Players.LocalPlayer --Using PlayerAdded is deprecated, user LocalPlayer instead.

player.PlayerGui.[Your ScreenGui name].PlayerName.Text = player.Name

Ad
Log in to vote
0
Answered by 5 years ago

You should try:

game.Players.PlayerAdded:Connect(function(plr)
    wait(1)
    game.StarterGui.StarterGui.PlayerName.Text = game.Players.LocalPlayer.Name
end)

Else you should add a waitforchild function at the startergui

0
It didn't work. iiBuilder_Boy 27 — 5y
0
And I don't know how to make a waitforchild function because I am not really that good at scripting. I'm still trying to learn. iiBuilder_Boy 27 — 5y
0
Don’t see the problems? Luka_Gaming07 534 — 5y
Log in to vote
0
Answered by 5 years ago

Put the localscript inside the text

local player = game.Players.LocalPlayer
local text = script.parent

text.text = player.name

Answer this question