Disabling parts of the game interface

Overview[edit]

ROBLOX comes with a set of GUI elements that are by default enabled for all games. These include the list of players, the current player's health bar, the player's backpack, and chat. If you do not need one of these elements or you have written your own, the StarterGui service has functionality to enable and disable each of these elements.

How To[edit]

StarterGui has a function called SetCoreGuiEnabled which is used to turn on and off elements of the basic GUI that ROBLOX provides. The first thing the function needs is a CoreGuiType. This is the element you want to set. The second thing the function needs is a boolean which represents whether you want that element on or off. The list of elements you can enable or disable are:

  • Enum.CoreGuiType.PlayerList
  • Enum.CoreGuiType.Health
  • Enum.CoreGuiType.Backpack
  • Enum.CoreGuiType.Chat
  • Enum.CoreGuiType.All

SetCoreGuiEnabled can only be called in a local script. This means that any changes to the GUI you make will only apply to the player who owns that local script.

Examples[edit]

Example

This example just turns off the Health bar

local StarterGui = game:GetService('StarterGui')
 
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)


Example

This example turns off all of the Core GUIs

local StarterGui = game:GetService('StarterGui')
 
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)


Example

This example turns off all of the Core GUIs except for Chat

local StarterGui = game:GetService('StarterGui')
 
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)


iOS GUI[edit]

When a ROBLOX game is played on iOS, two more elements are added to the players GUI: a control pad and a jump button. Those can be hidden by using the UserInputService like this:

local UIS = game:GetService('UserInputService')
UIS.ModalEnabled = true

Xbox One GUI[edit]

The Xbox One version of Roblox has a few differences than other platforms.

  • Chat - The chat GUI does not appear and any calls to SetCoreGuiEnabled(Enum.CoreGuiType.Chat) are ignored
  • Playerlist - The playerlist is always enabled and any calls to SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) are ignored
  • Topbar - The topbar does not appear