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

Can someone help me with this GUI opening script?

Asked by 9 years ago
function onClicked()
    if game.Workspace.StarterGui.Shop.ImageButton.Frame.Visible = false then

    game.Workspace.StarterGui.Shop.ImageButton.Frame.Visible = true
end
    script.Parent.MouseButton1Click:connect(onClicked)

    function onClicked()
        if game.Workspace.StarterGui.Shop.ImageButton.Frame.Visible = true
        game.Workspace.StarterGui.Shop.ImageButton.Frame.Visible = false
        end

        script.Parent.MouseButton1Click:connect(onClicked)

1 answer

Log in to vote
1
Answered by
DevWork 80
9 years ago

Well, you had several errors. Fixed them all up.

script.Parent.MouseButton1Click:connect(function()
    if game.Players.LocalPlayer.Shop.ImageButton.Frame.Visible == false then
        game.Players.LocalPlayer.Shop.ImageButton.Frame.Visible = true
    elseif
        game.Players.LocalPlayer.Shop.ImageButton.Frame.Visible == true then
            game.Players.LocalPlayer.Shop.ImageButton.Frame.Visible = false
        end
end)

0
it's still not working. I put it in the screengui btw. zachhg03 35 — 9y
1
The above should be a LocalScript inside of the Button. Shawnyg 4330 — 9y
0
Oh, thanks. zachhg03 35 — 9y
Ad

Answer this question