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 4 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 — 4y
0
I put it under the gui. iiBuilder_Boy 27 — 4y
0
I'm not quite sure you can change startergui... Hm.. veljkov007 0 — 4y
0
Make a remote event. User#25281 0 — 4y

3 answers

Log in to vote
0
Answered by
zuup123 99
4 years ago
Edited 4 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 4 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 — 4y
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 — 4y
0
Don’t see the problems? Luka_Gaming07 534 — 4y
Log in to vote
0
Answered by 4 years ago

Put the localscript inside the text

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

text.text = player.name

Answer this question