How do i make an open and close script for a shop?

Hello everyone! Im working on a game,but i don’t know how to do this script.
could anyone help me out?
i want when you click that cart icon,it opens the shop frame

1 Like

You can do this:

script.Parent.Activated:Connect(function()
	script.Parent.ShopFrame.Visible = not script.Parent.ShopFrame.Visible
end)

This should work if you put this code in the LocalScript that is already there.

2 Likes

You should do something like this:
Start the script by getting the button and the shop frame.
Then add a debounce for if it is open.
Then make a function that checks if the debounce is false or true. Then set the shop frame’s visible property to the opposite and make the debounce the opposite of it’s old value.
Then connect the function with a MouseButton1Click event. It should work.

2 Likes

Hey this works great, but i have one little problem. when i join the game the the shop frame is visible when i didn’t click it. how could i fix that?

You can add this line to the top of the script:

script.Parent.ShopFrame.Visible = false
1 Like

Thank you @killer08932, you helped me a ton! this page will now be closed. i will post again if i run into a problem

1 Like