Gui error visibility

I make script which is this

script.Parent.MouseButton1Click:Connect(function()

script.Parent.Parent:WaitForChild("Credits").Visible = not script.Parent.Parent:WaitForChild("Credits").Visible

end)

local Gamepass = game.StarterGui.Shop.MainFrame.Gamepass

local Credits = game.StarterGui.Shop.MainFrame.Credits

local Cash = game.StarterGui.Shop.MainFrame.Cash

local Mutators = game.StarterGui.Shop.MainFrame.Mutators

if Gamepass.Visible == true then

Credits.Visible = false

elseif Gamepass.Visible == false then

Credits.Visible = true

end

if gamepass frame is bisible the credits will be not visible but when i test i get error

Maybe make the credits frame close if the gamepass frame is open? (MouseButton1Down/Click)

You cannot be changing GUI properties by referencing StarterGui, it’s a service. Changing anything inside of it will not replicate.

Could you send a screenshot of your explorer, specifically the GUI and its children?

Untitled

I assume the script you showed me is Handler?

local MainFrame = script.Parent.MainFrame

local Gamepass = MainFrame.Gamepass
local Credits = MainFrame.Credits
local Cash = MainFrame.Cash
local Mutators = MainFrame.Mutators

local isOpen = false
script.Parent.Open.MouseButton1Click:Connect(function()
    if not isOpen then
        MainFrame.Credits.Visible = true
        Gamepass.Visible = false
        isOpen = true
    else
        MainFrame.Credits.Visible = false
        Gamepass.Visible = true
        isOpen = false
    end
end)

If you receive any errors, let me know

1 Like

yes its handler but still not working…

Change the Zindex of it to a greater value or make it visible = false