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

Add a users username onto the end of a text label?

Very simple question I guess, but I can't seem to find the way to add on the user's username onto a text label.

Here is the script I have made to hopefully find the users username.

repeat wait(1) until game:IsLoaded()
local player = game.Players.LocalPlayer
local name = player.Name

local text = "Well, welcome I guess"
local Sound = script.Parent.Sound
for i = 1, #text do
	script.Parent.TextLabel.Text = string.sub(text, 1, i)
	Sound:Play()
	wait()
end

Sound:Stop()

This is the part I am guessing we need to focus on, I am trying to add the local name to the end of local text = "Well, welcome I guess". I would then also be like to add "..." at the end after the name part too.

local player = game.Players.LocalPlayer
local name = player.Name

local text = "Well, welcome I guess"

So from what my head is imagining, it should look or do something like this

local player = game.Players.LocalPlayer
local name = player.Name

local text = "Well, welcome I guess USERNAME..."

So it's adding on the username part to the end but then also adding the three periods too.

1 answer

✓ Accepted answer

.. adds two strings together. Here is how you would add the player's name to the end of the text string.

local text = "Well, welcome I guess, " .. player.Name .. "..."

2 comments

0

Aha, thanks!

0

np

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