Roblox experiences include UI elements that are enabled by default. These include:
- A list of players within the experience.
- The character's health bar.
- The character's backpack.
- A chat window.
- A popup menu of character emotes.
If you don't need any of these elements or if you want to replace the default UI elements with your own creations, StarterGui has the functionality to let you enable or disable each default UI element.
StarterGui has a SetCoreGuiEnabled() function that you can use disable default UI elements. This function has CoreGuiType enums you can enable or disable when a user enters your experience, including:
To disable individual UI elements, you must specify the CoreGuiType and a boolean value of false for that CoreGuiType. For example, the following LocalScript demonstrates how to disable the health bar while keeping every other default UI element enabled:
1local StarterGui = game:GetService("StarterGui")23StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)4
However, if you want to disable all default UI elements except for one, you can also use SetCoreGuiEnabled() to reenable UI elements after you have disabled them. For example, the following LocalScript disables all default UI elements, then reenables the chat window:
1local StarterGui = game:GetService("StarterGui")23StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)4StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)5
Disabling Touch UI Elements
When users access experiences through a device with touch capabilities, such as a phone or tablet, Roblox adds two additional UI elements to the PlayerGui: a control pad and a jump button. You can hide these two elements by setting the TouchControlsEnabled of the GuiService to a boolean value of false in a LocalScript:
1local GuiService = game:GetService("GuiService")23GuiService.TouchControlsEnabled = false4