Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a button that opens a gui?

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

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)




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.

3 comments

0

please put local infront of ur vars .-.

0

.-. really had to downvote me for that... functions just fine.

0

i willl test it.

This discussion is preserved as it was. New answers, comments, and votes are closed.