Hi I was making a shop script and when I started to put a debounce in it all it did was when I opened the shop and tried to close it. The close button didn't work. Can you help?
local frame = script.Parent.Parent.Parent.Frame2
local stop = false
function click()
if not stop then
stop = true
if frame.Visible == false then
script.Parent.Text = "Close"
frame.Visible = true
frame:TweenPosition(UDim2.new(0, 300, 0, 0), "Out", "Back", 1)
elseif frame.Visible == true then
script.Parent.Text = "Shop"
frame:TweenPosition(UDim2.new(0, 300, 0, -350), "Out", "Quad", 1)
stop = false
wait(0.9)
frame.Visible = false
end
end
end
script.Parent.MouseButton1Click:connect(click)

1 comment
Btw, you should consider reducing the tween time.