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

Can you disable Core Gui's and then re-enable them when a frame is visible?

Asked by 8 years ago

So I have a GUI, that when opened I need the backpack to be shown. When the Shop Frame is visible, I need the backpack visible. But when the Shop frame is closed, I the need the backpack to hide.

This code will disable the Backpack once the player joins

local StarterGui = game:GetService('StarterGui')

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

This is what I tried to add

local player = game.Players.LocalPlayer

if player.PlayerGui.Shop.Main.Visible == true then
    StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)

This code, however, does not work.

How would I make it so once a frame is visible, it will set the Backpack to true?

Answer this question