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 4 years ago
Edited 4 years ago

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

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

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

and

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

and this

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

can anyone help me?

2 answers

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

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

To concatenate use dots like this:

local message = script.Parent.TextLabel
message.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:

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

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

local user = game.Players.LocalPlayer
local message = script.Parent.TextLabel

message.Text = ("Welcome, ", user.Name)

Hope it works.

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

Answer this question