PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Disabling the Game Interface

Disabling the Game Interface

Jul 02 2018, 4:45 PM PST 2 min

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
  • chat window

If you do not need one of these elements or you have written your own, the StarterGui service has the functionality to enable and disable each of them.

How To Turn On/Off GUI Elements

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 (true/false value) 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

This example just turns off the Health bar:

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

This example turns off all of the Core GUIs:

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

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

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

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
Tags:
  • gui
  • game
  • chat
  • coding