Hey! So I'm trying to make a menu that tweens up and down when you click a button. Only problem is the BoolValue that controls if the tween goes up or down doesn't change, It stays on false even though I've changed it in the script. Here is the code:
Open = script.Parent.Open
Open.Value = false
debounce = false
script.Parent.MouseButton1Click:Connect(function()
if Open.Value == false then
if debounce == false then
debounce = true
Open.Value = true
script.Parent.Text = "Close"
script.Parent.Parent.Main:TweenPosition(UDim2.new(0.2,0,0.2,0))
wait(3)
debounce = false
elseif debounce == true then
print("Debounce is true cant do that")
elseif Open.Value == true then
Open.Value = false
if debounce == false then
debounce = true
script.Parent.Text = "Menu"
script.Parent.Parent.Main:TweenPosition(UDim2.new(0.2,0,-1,0))
wait(3)
debounce = false
elseif debounce == true then
print("Debounce is true cant do that")
end
end
end
end)
If somebody could help me with my problem that would be greatly appreciated! Thanks!

3 comments
Instead of “if Open.Value == false then” and the line after that “if debounce == false then”, do “if Open.Value == false and debounce == false then”
put 'local' before the Open variable at the top
Same with the debounce variable