I made a local script for my imagebutton that if the player clicks the button the StarterGUI is disabled when the gui is shown and when the player exits the gui the StarterGUI is enabled but I have a problem. When I click the imagebutton the leaderstats, playerlist, chat is disabled but I can still see gui. I might be dumb but here is a screenshot of it.
If you are trying to disable all ScreenGui’s in PlayerGui, instead of using the StarterGui service, just loop through every ScreenGui in PlayerGui and disable all of them.
Example:
local btn = script.Parent
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
btn.Activated:Connect(function()
for _, guis in pairs(PlayerGui:GetDescendants()) do
if guis:IsA("ScreenGui") then
guis.Enabled = false -- disables all ScreenGuis
end
end
-- reenable the ScreenGui that you want to stay visible
PlayerGui:FindFirstChild("NAME OF SCREENGUI HERE").Enabled = true
end)
Now to reenable all the ScreenGui’s again, use the same method above and just set the Enabled property to true
for _, guis in pairs(PlayerGui:GetDescendants()) do
if guis:IsA("ScreenGui") then
guis.Enabled = true -- enables all ScreenGui's in PlayerGui
end
end