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

GUI Shop Open And Close Script Not Working? (SOLVED)

Asked by
KingDomas 153
5 years ago
Edited 5 years ago

So I am making a GUI shop for my game but when I am trying to make an open/close script, it never seems to work. Am I missing something or doing something wrong? Here is what my localscript contains:

local button = game.StarterGui.Shop.openclose.openclose
local Opened = false
local ShopFrame = button.Parent.Parent.main

button.MouseButton1Click:Connect(function()
    if Opened == false then
        ShopFrame.Visible = true
        Opened = true
    else
        ShopFrame.Visible = false
        Opened = false
    end
end)

Answer: Basically I changed the script so it would work. This is what I got:

local frame = script.Parent.Parent.main
local open = false

script.Parent.openclose.MouseButton1Click:connect(function()
    if frame.Visible == false then
        frame.Visible = true
    else
        frame.Visible = false
    end
end)

1 answer

Log in to vote
0
Answered by
clc02 553 Moderation Voter
5 years ago

You switched up lines 08 and 11, don't worry, it happens to everyone.

0
Thanks but for some reason, it still won't open. KingDomas 153 — 5y
0
Hmm. Select it in test mode's explorer, click the button. Does it change it's Visible property? Put a print after line 05 and see if it reaches that point? clc02 553 — 5y
0
It's already solved clc02 but thanks for trying! KingDomas 153 — 5y
Ad

Answer this question