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

a textlabel puts the name of the localplayer?

Asked by 4 years ago

so I made this

`local username = game.Players.LocalPlayer.Name

script.Parent.Text = "Hello, ('"..username"')."

`

and it doesn't seem to be working

3 answers

Log in to vote
0
Answered by 4 years ago

You did a very simple mistake. You forgot the two dots ('..') in the end of the word 'username'. The correct way is:

local username = game.Players.LocalPlayer.Name
script.Parent.Text = "Hello, ('"..username.."')."

Ad
Log in to vote
0
Answered by 4 years ago

Thanks!

Log in to vote
0
Answered by 4 years ago

Make sure it's a Local Script and if it is use the script below:

local Username = game.Players.LocalPlayer
local TextLabel = script.Parent.TextLabel

TextLabel.Text = "Hello, ('"..Username.Name.."')

-- If you want to filter the text:

local TextService = game:GetService("TextService")
local filteredTextResult = TextService:FilterStringAsync(text, fromPlayerId)

TextLabel.Text = "Hello, ('"..Username.Name.."')

https://developer.roblox.com/en-us/articles/Text-and-Chat-Filtering -- More info about filtering.

Answer this question