How would I make it so the same action won't happen, but instead another event will happen?

I’m currently making a menu UI and I’m having an issue where when I click the button again the same thing will happen, but I want to make it so that Button2 will be active and the other will not, etc.

Code:

local Frame = script.Parent
local Button1 = script.Parent.ImageButton
local Button2 = script.Parent.ImageButton2

local function onButton1Activated()
	
	Frame.AnchorPoint = Vector2.new(0, 0)
	Frame.Position = UDim2.new(0, -95, 0.129, 0)
	wait(0.7)
	Frame:TweenPosition(UDim2.new(0.005, 0, 0.128, 0))
	Button1.Visible = false
	wait(0.0001)
	Button2.Visible = true
end

Button1.Activated:Connect(onButton1Activated)
Button2.Activated:Connect(onButton1Activated)

Video:

If you can see it appears again when Button2 is visible, and I want to make it so it tweens back to the original position without it doing the first tween.

Ok, I’ve seem to of solved the issue on my own and it seems I put “Activated” instead of “Active”

1 Like

LOL, ok, well you can also use BoolValues to save the two position of the Gui.