How to hide all guis, including ones in starter gui?

How would i hide all the guis in my game?

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local starterGui = game:GetService('StarterGui')

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

local GUI = script:WaitForChild("LoadingScreen")

local plr = game.Players.LocalPlayer

GUI.Parent = plr.PlayerGui

script.Parent:RemoveDefaultLoadingScreen()

repeat

wait(.5)

until game:IsLoaded()

wait(10)

GUI.Frame:TweenPosition(UDim2.new(0,0,-1.5,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad, 1)

game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)

wait(1)

print ("loaded")

GUI:Destroy()
2 Likes

try

game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
for i,v in ipairs(game:GetDescendants())do
    if v:IsA('ScreenGui')then
         v.Enabled = false
end end

image
ah, one problem.
it destroys the loading screen

no it does not


maybe after my code you can set the

proterty to true

If you want to hide the ScreenGui's then you would have to loop through PlayerGui and set .Enabled property to false. And if you want to hide only the GUIs in some ScreenGui then you just loop through the ScreenGui and set .Visible property to false.

Do not use this! This will loop through every single instance in your game and it could bring some expensive performance issues.