When printing (or changing a Text value), it will not let you put multiple things in the parentheses.
For example:
nom = game.Players.Player1.Name print("hi there" nom)
The above script will not work. However, if you were to take out either the '"hi there"' or the 'nom', it would run fine. How do I make it so that it can print out multiple things in one line?
Two strings can be joined into one string by concatenation.
The concatenation operator in Lua is ..
(two dots).
For example,
print( 3 .. 2 ) -- 32 print("Root 2 is " .. math.sqrt(2))
As an aside, print
will actually take multiple arguments:
print(3, 2) -- 3 2
It inserts a tab ("\t"
) between them, which the ROBLOX output will render as a space (since it is HTML renderer).
nom = game.Players.Player1.Name print("hi there "..nom) --Put a space after 'hi there'. Otherwise it would say "hi therePlayer1"
You use 2 dots.
Ex:
game.Players.PlayerAdded:connect(function(plr) a=plr.Name print("A new player ("..a..") has entered the server") end)
You could do the same thing with a GUI you would just do
--Assuming its in the text game.Players.PlayerAdded:connect(function(plr) a=plr.Name script.Parent.Text=("A new player ("..a..") has entered the server!")