โ† Back to all scripts

GUI Slide-in Tween

Animate a Frame sliding on and off screen. Great for menus and panels.

GUIBeginnerLocalScript in StarterGui
gui-slide-in-tween.lua
-- GUI Slide-in / Slide-out
local TweenService = game:GetService("TweenService")
local gui        = script.Parent
local frame      = gui:WaitForChild("MenuFrame")
local openButton = gui:WaitForChild("OpenButton")
local tweenInfo  = TweenInfo.new(0.4, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local isOpen     = false
local OPEN_POS   = UDim2.new(0.5, 0, 0.5, 0)
local CLOSED_POS = UDim2.new(0.5, 0, 1.5, 0)
frame.Position   = CLOSED_POS

openButton.MouseButton1Click:Connect(function()
    isOpen = not isOpen
    TweenService:Create(frame, tweenInfo,
        { Position = isOpen and OPEN_POS or CLOSED_POS }):Play()
end)
Related scripts in GUI
Toast NotificationIntermediate โ†’Mobile Action ButtonBeginner โ†’
Something broken or not working?
๐Ÿ”ง Try the AI Script Fixer โ†’