---
# System prepended metadata

title: PID-1174

---

To make a TextButton slide down its parent Frame and then close it, you can use the `TweenService module` in `Roblox`. Here's an example of how to do it:

```lua
-- Get references to the TextButton and its parent frame
local button = script.Parent
local parentFrame = button.Parent

-- Define the positions for the animation
local startPosition = UDim2.new(0.281, 0, 0.206, 0)
local endPosition = UDim2.new(0.281, 0, 0.988, 0)

-- Define the duration of the animation in seconds
local animationDuration = 1

-- Get the TweenService
local tweenService = game:GetService("TweenService")

-- Function to animate the frame
local function animateFrame()
    -- Create a TweenInfo object for the animation
    local tweenInfo = TweenInfo.new(
        animationDuration,
        Enum.EasingStyle.Linear,
        Enum.EasingDirection.InOut
    )

    -- Define the properties to tween (Position in this case)
    local properties = {
        Position = endPosition,
    }

    -- Create the tween
    local tween = tweenService:Create(parentFrame, tweenInfo, properties)

    -- Play the animation
    tween:Play()

    -- Connect a function to be executed when the tween completes
    tween.Completed:Connect(function()
        -- Close the parent frame (you may need to customize this part)
        parentFrame.Visible = false
    end)
end

-- Function to handle button click
local function onButtonClick()
    -- Play the animation when the button is clicked
    animateFrame()
end

-- Connect the button click event to the click handler
button.MouseButton1Click:Connect(onButtonClick)
```
This code defines a function to animate a frame's position using Roblox's `TweenService` when a button is clicked. It specifies animation parameters like duration and easing style, creates a tween, plays it, and hides the frame when the animation completes. The button click event triggers this animation.