UI sliding to another image

LINK: https://gyazo.com/51db8264517674d9320c75d72c41ee2f

local debounce = 0 — this means the gui is closed
local menu = script.Parent.Parent.ImageLabel – quick way to reference the menu gui

script.Parent.MouseButton1Click:connect(function()

if debounce == 0 then – checks if the menu is closed
debounce = 1 – this means the menu is in process of sliding

for i = 1,10 do
wait(0.02)
menu.Position = menu.Position + UDim2.new(0.02,0, 0,0) – this moves the gui
end
debounce = 2 – this means the menu is open

else if debounce == 2 then – checks if the menu is open
debounce = 1 – this means the menu is in process of sliding

for i = 1,10 do
wait(0.02)
menu.Position = menu.Position - UDim2.new(0.02,0, 0,0) – this moves the gui
end
debounce = 0 – this means the menu is closed

end
end)

We need more information about what is wrong. Right now, your code lacks context and all I can tell is that you are trying to change some UI positions when you click. Give me details and I think I can help.

I’m confused is this what you’re trying to achieve? Have you achieved this? You need to say what are you trying to do exactly and say what needs help with.