Gui not going invisible

I didn’t know what category to put this in, forgive me if it’s in the wrong category. So, I’m trying to do some finishing touches to my inventory system and I tried to put it where the exp bar will disappear as well as the currency tab when the inventory opens but the gui never disappeared. I looked in the output and there was no error or warning. I tried to change it where the image transparency will go to 1 but it did the same thing, nothing happened and the output showed nothing. Here’s a video of what’s happening.

sorry for the bad quality.
robloxapp-20210318-1432206.wmv (1.2 MB)

Here’s the script.

--Variables
local starterGUI = game:GetService("StarterGui")
local inventoryOpen = starterGUI.Inventory.InventoryOpened.Value

--GUI Variables
local currencyExterior = script.Parent.CurrencyExterior
local currencyInterior = currencyExterior.CurrencyInterior
local currencyText = currencyInterior.TextLabel
local levelExterior = script.Parent.LevelExterior
local levelExterior2 = levelExterior.LevelExterior
local levelInterior = script.Parent.LevelInterior
local bar = levelInterior.Bar
local barShadow = levelInterior.BarShadow
local levelInterior2 = levelInterior.LevelInterior
local exp = levelInterior.EXP
local levelLabel = levelInterior.Label

if inventoryOpen == true then
	currencyExterior.Visible = false
	currencyInterior.Visible = false
	currencyText.Visible = false
	levelExterior.Visible = false
	levelExterior2.Visible = false
	levelInterior.Visible = false
	levelInterior2.Visible = false
	bar.Visible = false
	barShadow.Visible = false
	exp.Visible = false
	levelLabel.Visible = false
else
	currencyExterior.Visible = true
	currencyInterior.Visible = true
	currencyText.Visible = true
	levelExterior.Visible = true
	levelExterior2.Visible = true
	levelInterior.Visible = true
	levelInterior2.Visible = true
	bar.Visible = true
	barShadow.Visible = true
	exp.Visible = true
	levelLabel.Visible = true
end

Does anyone know how to resolve this?

you could try to disable the screen instead of the individual frames
You should also check if it is even trying to disable the frames. Adding a print statement on the second line would work

local starterGUI = game:GetService("StarterGui")
local inventoryOpen = starterGUI.Inventory.InventoryOpened
inventoryOpen.Changed:Connect(function()
local currencyExterior = script.Parent.CurrencyExterior
local currencyInterior = currencyExterior.CurrencyInterior
local currencyText = currencyInterior.TextLabel
local levelExterior = script.Parent.LevelExterior
local levelExterior2 = levelExterior.LevelExterior
local levelInterior = script.Parent.LevelInterior
local bar = levelInterior.Bar
local barShadow = levelInterior.BarShadow
local levelInterior2 = levelInterior.LevelInterior
local exp = levelInterior.EXP
local levelLabel = levelInterior.Label

if inventoryOpen == true then
	currencyExterior.Visible = false
	currencyInterior.Visible = false
	currencyText.Visible = false
	levelExterior.Visible = false
	levelExterior2.Visible = false
	levelInterior.Visible = false
	levelInterior2.Visible = false
	bar.Visible = false
	barShadow.Visible = false
	exp.Visible = false
	levelLabel.Visible = false
else
	currencyExterior.Visible = true
	currencyInterior.Visible = true
	currencyText.Visible = true
	levelExterior.Visible = true
	levelExterior2.Visible = true
	levelInterior.Visible = true
	levelInterior2.Visible = true
	bar.Visible = true
	barShadow.Visible = true
	exp.Visible = true
	levelLabel.Visible = true
end
end)

It looks to me the value inventoryOpen isn’t changing
things to try:

check if the value changes
check if your using the right value

if inventoryOpen.Value then
    --RunCode
end

If inventoryOpen is a boolean value

But you need to check when the value changes, that’s why i put it in a function.

So i added print functions and they never printed so that could mean that its the if statement.

can you tell what value you are using it might help us find the problem

Make it so it checks everytime the value updates

I’m using a bool value, and i noticed that value never changed when you asked me that, so it wasnt the script it was the value. The value should have changed in the inventory script

Try the script I put up there.

I did it didn’t work, it was the value though not the script

1 Like

I can see a problem in your script you are after the if statement that you never try to change the inventoryOpen value so even if its working you will still have the problem of the EXP bar not getting back its visibility what i should do to fix one of your problems is

if inventoryOpen == true then
    inventoryOpen = false
	currencyExterior.Visible = false
	currencyInterior.Visible = false
	currencyText.Visible = false
	levelExterior.Visible = false
	levelExterior2.Visible = false
	levelInterior.Visible = false
	levelInterior2.Visible = false
	bar.Visible = false
	barShadow.Visible = false
	exp.Visible = false
	levelLabel.Visible = false
else
    inventoryOpen = true
	currencyExterior.Visible = true
	currencyInterior.Visible = true
	currencyText.Visible = true
	levelExterior.Visible = true
	levelExterior2.Visible = true
	levelInterior.Visible = true
	levelInterior2.Visible = true
	bar.Visible = true
	barShadow.Visible = true
	exp.Visible = true
	levelLabel.Visible = true
end

if you use this you will change the value’s value that will help you get the bar back

From what it looks like, you are using starterGui instead of playergui. Also is inventoryOpen the instance of the value or the value itself?

The value still didn’t change, I’m gonna see if I delete and replace the bool value with a new one hopefully it’ll work

Its interesting i tested a bool value myself and it works amazing are you getting any errors

no, the bool still isn’t working and I don’t know why it’ll turn itself true but the gui never disappears and will stay true until I turn it false manually and will never go true again. i don’t really know what’s going on

That is very interesting i will do some test with my own script for you. i will try to help you find a solution

ok, if you want i can take images of the inventory gui and levels gui and post them here to help you out

yeah maybe they will help find a solution