Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

sorry i just need it for my game

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Antelear 185
2 years ago
Edited 2 years ago
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.

Ad
Log in to vote
0
Answered by 2 years ago

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