One of the key features of Roblox Studio is the ability to use the BillboardGui, which is a graphical user interface (GUI) element that can be used to display text, images, and other content in your game. In this article, we'll take a closer look at how to use the BillboardGui in Roblox Studio.
What is the BillboardGui?
The BillboardGui is a GUI element that always faces the player, no matter where they are located in the game world. This means that the content displayed on the BillboardGui will always be visible to the player, even if they move around the game world or change their perspective.
The BillboardGui is commonly used to display important information to the player, such as health and score displays, as well as for displaying in-game messages and instructions.
Create A BillboardGui And Change It’s Properties
So you can see how it looks while you are adjusting the properties it is good to insert a Dummy into the workspace where you can attach a BillboardGui and see the changes as you work.
Click on the Avatar tab at the top of the toolbar.
Click on Rig Builder, and then My Avatar
This will insert a copy of your Avatar into the workspace. You will notice that it has the word “Rig” above its head. To get rid of this do the following.
Left click the Rig in the explorer window.
Click on the arrow to the left of its name to expand its contents.
Left Click on Humanoid, then in its properties find the property called DisplayDistanceType. Change it to say None. The word Rig should now disappear.
Adding a BillboardGui To The Rig
In the Rig find the body part called Head. Select it then click the + sign and find BillboardGui. Left click it to add it to the Rigs head. Now you have a BillboardGui select it and add a TextLabel. You should see a big label appear. Similar to the image below.
As you can see the default settings are not really the best. So you will need to change some properties of the BillboardGui and the TextLabel so it becomes more useful.
Select the BillboardGui and in its properties fin the StudsOffset property.
Change its Y value to 5. This will raise the gui above the Rigs head as shown below.
To make the Gui brighter change the property LightInfluence to 0.
AlwaysOnTop = true
Change The TextLabel
To create the appearance below make change to the following TextLabel properties. By all means experiment with these and change them to something that suits your own needs.
AnchorPoint = X = .5 Y = .5
BackgroundTransparency = 0.6
BackgroundColor3 = 0,0,0
BorderColor3 = 45,255,232
BorderSizePixel = 5
Position - Scale X = .5. Y = .5
Size = Offset X = 190. Y = 45
TextColor3 = 255,248,46
TextScaled = true
When you have finished with the properties of your BillboardGui and Textlabel. Right click on the BillboardGui and choose Cut, then find the StarterCharacterScripts folder in the StarterPlayer folder. Select it, right click and choose Paste Into. You can now play the game and see how the Billboard looks on your player. Adjust any setting you need to.
Change The Text In Code
To change the text of the GUI add a script to the ServerScriptService and add the following lines. These 2 lines of code can be used in other scripts to let you change the lines whenever you need to.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local headGui = character:WaitForChild("BillboardGui").TextLabel headGui.Text = "It works!"