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

How to make a button that opens a gui?

Asked by
Troevan -8
5 years ago

so what im trying to do is making a button with a shop icon (called Shopselect) and what i want it to do is open up a gui (called Shop)

2 answers

Log in to vote
0
Answered by 3 years ago

There are a ton of free models that offer scripts to do what you need, However here is i think what you want:

LocalScript btw

local Button = script.Parent
local Frame = script.Parent.Parent.Shop  -- The place where your shop gui is at
local Debounce = false

Button.MouseButton1Up:Connect(function()
           if Debounce == false then
               Debounce = true
                Frame.Visible = true -- Make the shop gui you are trying to show invisible btw
          elseif Debounce == true then
          Debounce = false
           Frame.Visible = false
end
end)




Ad
Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago

Considering that the starterGui is setup like this:

starterGui localScript screenGui Shopselect toggleGui

you could do this:

script.Parent.screenGui.toggleGui.MouseButton1Click:Connect(function()
    local button = script.Parent.screenGui.Shopselect
    button.Visible = not button.Visible
    button.Text = button.Visible and "Close Gui" or not button.Visible and "Open Gui"
end)

Haven't tested it, but should work.

0
please put local infront of ur vars .-. Imperialy 149 — 5y
0
.-. really had to downvote me for that... functions just fine. Internal_1 344 — 5y
0
i willl test it. Troevan -8 — 5y

Answer this question