Slide-Out Menu with Reversible Animation thumbnail
0 views0 copies0 likes

Slide-Out Menu with Reversible Animation

Universal script

Copy it, then test it in your own Studio place.

UI systems Verified

Script code

14 lines · 0.6 KB
Download
local TweenService = game:GetService("TweenService")local gui = script.Parentlocal panel = gui:WaitForChild("MenuPanel")local toggle = gui:WaitForChild("MenuToggle")local open = panel.Positionlocal closed = UDim2.new(-1, -panel.AbsoluteSize.X, open.Y.Scale, open.Y.Offset)local visible, tween = false, nilpanel.Position = closedtoggle.Activated:Connect(function()	visible = not visible	if tween then tween:Cancel() end	tween = TweenService:Create(panel, TweenInfo.new(0.3, Enum.EasingStyle.Quart), {Position = visible and open or closed})	tween:Play()end)

About this script

Inside a ScreenGui, create a Frame named MenuPanel and a TextButton named MenuToggle. Add this LocalScript alongside them. The button moves the panel between the position set in Studio and a point offscreen, canceling the old tween when clicked mid-animation. Keep the menu toggle outside the sliding panel and check narrow screen sizes before choosing the open position.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local TweenService = game:GetService("TweenService")
local gui = script.Parent
local panel = gui:WaitForChild("MenuPanel")
local toggle = gui:WaitForChild("MenuToggle")
local open = panel.Position
local closed = UDim2.new(-1, -panel.AbsoluteSize.X, open.Y.Scale, open.Y.Offset)
local visible, tween = false, nil
panel.Position = closed
toggle.Activated:Connect(function()
	visible = not visible
	if tween then tween:Cancel() end
	tween = TweenService:Create(panel, TweenInfo.new(0.3, Enum.EasingStyle.Quart), {Position = visible and open or closed})
	tween:Play()
end)