Disable Core GUIs (Chat, Backpack, etc)

A quick method of disabling the chat, the backpack, etc...

by antvvnio

Author Avatar

If you want your game to have a custom chat, or just to disable it, you came to the right tutorial.

Firstly we want to save the "StarterGui" service into a variable.

local starterGui = game:GetService("StarterGui")

After that, you wanna use the method of the StarterGui service called "SetCoreGuiEnabled".

THIS ONLY WORKS ON LOCALSCRIPTS


  1. The first parameter is Enum CoreGuiType. For an example, if you would wanna disable the chat you would do:
Enum.CoreGuiType.Chat

-- If you wanna disable all core GUIs, you would do:

Enum.CoreGuiType.All

You can find more info about this Enum on the Roblox Documentation.


  1. The second parameter is a boolean, which indicates if you wanna enable (true) or disable (false) a core GUI.
--SetCoreGuiEnabled(coreGuiType: CoreGuiType, enabled: boolean)

Now that we know how this method works, let's do a script that disables the chat.

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

You may notice that when you disable the core GUIs instantly when the player joins, the script will throw you an error.

We can solve that by using pcalls and a loop, like this.

local starterGui = game:GetService("StarterGui")

local success = false

repeat
	success = pcall(function()
		starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
	end)

	task.wait()
until success

This script will try setting the core GUI to false and if it fails, it tries again until successful.

If it fails, the "success" variable becomes false and the loop will will run the pcall once again, until it successfuly disables the core GUI and the "success" variable will be true since it threw no error.


I hope you understood something from me. See ya.

View in-game to comment, award, and more!