I created a script in which, when the GUI menu is clicked open, plays an animation and does the same animation in reverse when closing. However it only plays the open animation and not the closing one.

debounce=false

script.Parent.MouseButton1Click:connect(function()
	if not debounce then
		debounce=true
		if script.Parent.Image then
			-- OPEN ANIMATION --
			script.Parent.Parent.Frame.Visible=true
			for i=1,5 do
				-- Resize WIDTH --
				script.Parent.Parent.Frame.Size=script.Parent.Parent.Frame.Size+UDim2.new(0.05,0,0,0)
				wait()
			end
			for i=1,5 do
				-- Move UP --
				script.Parent.Parent.Frame.Position=script.Parent.Parent.Frame.Position-UDim2.new(0,0,0.05,0)
				wait()
			end
			for i=1,20 do
				-- Resize HEIGHT --
				script.Parent.Parent.Frame.Size=script.Parent.Parent.Frame.Size+UDim2.new(0,0,0.0225,0)
				wait()
			end
			script.Parent.Image="http://www.roblox.com/asset/?id=274812390"
		else
			-- CLOSE ANIMATION --
			script.Parent.Parent.Frame.Visible=false
			for i=1,5 do
				-- Resize WIDTH --
				script.Parent.Parent.Frame.Size=script.Parent.Parent.Frame.Size-UDim2.new(0.05,0,0,0)
				wait()
			end
			for i=1,5 do
				-- Move UP --
				script.Parent.Parent.Frame.Position=script.Parent.Parent.Frame.Position+UDim2.new(0,0,0.05,0)
				wait()
			end
			for i=1,20 do
				-- Resize HEIGHT --
				script.Parent.Parent.Frame.Size=script.Parent.Parent.Frame.Size-UDim2.new(0,0,0.0225,0)
				wait()
			end
			script.Parent.Image="http://www.roblox.com/asset/?id=274791999"
			
		end
		debounce=false
	end
end)

and no, I can't tween because I don't know how.

1 comment

0

http://wiki.roblox.com/index.php?title=Tweening#Metamethods tweening is a very powerful method. You should at least read this