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

How to name a brick with string and variable?

Let's say I have something like


local variable = 3

and another if statement that will change the variable of 3 and then I want to name a brick something like "There are x players left" where x is the value of the local variable. How would I do that, would it be

local variable = 3
game.Workspace.Brick.Name = "There are" + variable + "players left" 

1 answer

✓ Accepted answer

Yes, only insteal of a plus sign, string concatenation in Lua uses 2 dots ".." and there should be a space after the first string and a space before the last string.

local variable = 3
game.Workspace.Brick.Name = "There are "..variable.." players left" 

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