I want to set the text of a hint to a variable with text. Like this:
game.workspace.Message.Text = "The game will start in (variable)"
How can I do that?
This answer is mainly to clear up the two other answers.
Concatenation is basically a programmer word for joining things together.
To perform concatenation in Lua, all you need to do is add ..
in the right places;
local currentTime = "5 PM" local str = "The time is " ..currentTime.. "!" --// Notice the space between 'is' and the speech mark print(str) --// prints 'The time is 5 PM!'
A concatenation will error when you try and concatenate values that have not had tostring()
performed upon them (excluding numbers and objects).
Hope I helped!
~TDP
You're looking for this : Concatenation.
In your case it's going to be like this :
variable = "a couple of seconds..." workspace.Message.Text = "The game will start in " ..variable --The message should read : The game will start in a couple of seconds.
Here is a example as how you can use variubles in text.
local Info = 123456 print("My info is "..Info.."!")
So what we want to do is
local TimeOfStart = 20 seconds game.Workspace.Message.Text = "The game will start in "..TimeOfStart..". Please wait."
What this will put is "The game will start in 20 seconds. Please wait." If this answer is helpful, please accept the answer!