Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What's the fault in my localplayer code?

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

3 comments

0

What is Username?

0

GUYS. He's trying to set the name of a player. That's not even possible nor useful.

0

I see my fault.

2 answers

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!

I know it doesn't work the script is:

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

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