Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

what is the script for a gui button to enable all guis after clicking it?

sorry i just need it for my game

2 answers

GUIVariable.MouseButton1Click:Connect(function()
	for _, gui in pairs(GuiVariable.Parent:GetChildren()) do
	if gui ~= script then
		gui.Enabled = true
	end
end

By using a for loop, the gui variable is gonna change its property Enabled (if...it has it.). If it's not the script, then it will run. Hope this helps.

If you are talking about gui you made yourself, make a button and put a LocalScript in it and create a ScreenGui and call it AlwaysVisibleScreenGui and put a button in it so this script will not hide frames like hide/unhide frames button

local isEnabled = true
local plrGui = game:GetService("Players").LocalPlayer.PlayerGui -- a folder of all gui, only visible  when the game is running, located in a player's folder
local alwaysVisibleGuiScreen = plrGui:WaitForChild("AlwaysVisibleScreenGui") -- A screen gui which will be always visible
local button = script.Parent

button.MouseButton1Click:Connect(function()
	local screenGuis = plrGui:GetChildren() -- an array of all gui screens at the moment
	if isEnabled then isEnabled = false else isEnabled = true end -- changing a variable to determain whenever all gui are visible or not
	for i, v in pairs(screenGuis) do
		if v:IsA("ScreenGui") and v ~= alwaysVisibleGuiScreen then v.Enabled = isEnabled end
	end
end)

If you wish to hide all frames (even the ones made by roblox), add this line somewhere in a function: game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, isEnabled). If you have any questions, ask them in the comments

This discussion is preserved as it was. New answers, comments, and votes are closed.