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

What's the fault in my localplayer code?

Asked by 6 years ago

I've been working on a textlabel that's text equals the local player, but the script in my localscript won't work.

local player = game.Players.LocalPlayer

player.name = script.Parent.Username.Text
0
What is Username? User#23009 5 — 6y
0
GUYS. He's trying to set the name of a player. That's not even possible nor useful. Griffi0n 315 — 6y
0
I see my fault. Beugens 0 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

You can't change the player's name, you can change a TextLabel's Text to a players name. So first since we are dealing with GUI's, we have to deal with the Client. This means a LocalScript

Alright, so what you want to do is this:

local plr = game.Players.LocalPlayer
local TextLabel = script.Parent -- Put the localscript inside the TextLabel

TextLabel.Text = plr.Name -- Set the text to player's name

Hopefully, this helped you.

Best of luck developer!

Ad
Log in to vote
0
Answered by 6 years ago

I know it doesn't work the script is:

script.Parent.Text = game.Players.LocalPlayer.Name

Answer this question