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

How do you make a gui say a message and have a variable in the message also?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make welcome GUI? I guess and I tried

(I'm using a Local Script in a GUI)

1--Variabls--
2local user = game.Players.LocalPlayer
3local message = script.Parent.TextLabel
4--Scripts--
5message.Text = ("Welcome, "user)

and

1--Variabls--
2local user = game.Players.LocalPlayer
3local message = script.Parent.TextLabel
4--Scripts--
5message.Text = ("Welcome, ", user)

and this

1--Variabls--
2local user = game.Players.LocalPlayer
3local message = script.Parent.TextLabel
4--Scripts--
5message.Text = ("Welcome, ",user)

can anyone help me?

2 answers

Log in to vote
0
Answered by
aredanks 117
5 years ago

I believe you are trying to concatenate here in your local script,

To concatenate use dots like this:

1local message = script.Parent.TextLabel
2message.Text = "Welcome, "..(stringvalue)

You are also trying to concatenate using only the player, you must use the name property of it as it returns a string value (text), completing it as:

1local user = game.Players.LocalPlayer
2local message = script.Parent.TextLabel
3message.Text = "Welcome, "..user.Name
Ad
Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago

I think you should reference the player's Name instead of the player itself.

1local user = game.Players.LocalPlayer
2local message = script.Parent.TextLabel
3 
4message.Text = ("Welcome, ", user.Name)

Hope it works.

0
forgot the .name lol Cookie_clicker2 16 — 5y
0
i did Cookie_clicker2 16 — 5y
0
Great. piRadians 297 — 5y

Answer this question