How to remove a GUI

I know that to remove a block, you do :Destroy() but what do you do to remove a GUI?


Your GUI (which is most likely parented to StarterGui within Studio) is moved to the “PlayerGui” which is within the Player object. If you want to remove the GUI, you need to use a local script.

local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

local function DestroyGui()


Might I note, destroying the GUI may not be the best way to reach your goal. If you simply want to make the GUI stop appearing on the screen, you can also just disable the Enabled property within the ScreenGui.

local function SetEnabled(enabled)
    PlayerGui:FindFirstChild("Your_Gui").Enabled = enabled

SetEnabled(false) -- Makes the ScreenGui's Enabled property false which will make it invisible.

Can you just remove it from the startergui using the localscript? Do I have to find the playerGui within the player?

1 Like

A major misconception is that the ScreenGui within the StarterGui is what is shown on a player’s screen. This is not the case. The StarterGui is a service which inserts a clone of any Gui within it and places it within the PlayerGui for the player to see. The PlayerGui is actually where the Gui is shown, not from StarterGui. So, to sum it up, yes. You would need to remove it from the PlayerGui, not the StarterGui.

1 Like