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

How can I hide the CoreGui (backpack, chat, leaderboard) when I click a button of my Gui?

Asked by 4 years ago

How can I hide the CoreGui (backpack, chat, leaderboard) when I click a button of my Gui? So, when I click the "Play" button on my Gui, it creates a new instance (part)

menu = script.Parent.Parent.Parent
image = script.Parent.Parent
script.Parent.MouseButton1Down:connect(function()   
    image.ImageTransparency = 0.2
    changecoregui = Instance.new("Part",workspace)
    changecoregui.Name = "changecoregui"
    wait(0.2)
    image.ImageTransparency = 0.4
    wait(0.2)
    image.ImageTransparency = 0.6
    wait(0.2)
    image.ImageTransparency = 0.8
    wait(0.3)
    image.ImageTransparency = 1
    wait(0.3)
    menu:Destroy()
    end)

there is a local script at StarterGui that hides the all the CoreGui

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

and there is another local script at StarterGui that needs to show all the CoreGui back when I click the "Play" button. But it does not work, how can I fix it?

local startergui = game:GetService('StarterGui')
changecoregui = workspace:FindFirstChild("changecoregui")
if changecoregui then
    startergui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
end

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If you have the LocalScriot inside of the button(if your button is a gui) your code should look like this for enabling core guis:

local StarterGui = game:GetService("StarterGui")

script.parent.MouseButton1Click:connect(function()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
end

or if you wanted to click a brick, you would sinply insert a local script into the brick youre supposed to click not a StarterGui, only the brick youre supposed to click. anyway, your script should look like this:

local startergui = game:GetServiice(“StarterGui”)
local part = script.parent

local click = Instance.new(“ClickDetector”)
click.Parent = part
click.MaxActivation.Distance = 15

click.MouseClick:connect(function()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
end

if this helped you out, make sure to mark it as solved by me and if any more questions, my discord is Child#3611

0
Thank you. Daniel8947 2 — 4y
Ad
Log in to vote
0
Answered by
gloveshun 119
4 years ago

i made this script what works:

script.Parent.MouseButton1Click:Connect(function()
    game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end)

it must be in a localscript located at StarterGui

0
i mean located in a Text or imageButton gloveshun 119 — 4y

Answer this question