0

# How can I project a variable on a GUI?

In my game, I have a building with a surface GUI on a brick showing the name of the building, but I would like to know how I can have a variable on the GUI.

My game example: "Cylocx's building" on a surface GUI. but when another player has their building: "Guest 1156's building"

1
Perci1 4988
7 years ago

You use concatenation.

I'm not sure what you have set up, so I'll assume you already have a way to get the player's name.

playername = "Bob"

GUI.Text = playername.."'s building" --Replace GUI with the correct hierarchy.


What this does is basically combine the two strings. It does not have to be two strings though. You can use numbers as well.

local number = 10

print("I have "..number.." cookies")--It combines everything exactly, so make sure you have the spaces right!