Slide open gui? Help scripting

Does anyone know how to make gui slide open?

I searched everywhere this is a last resort lol.

I have tried discord help channels search the dev forums and youtube

use Tween Service:
TweenService | Documentation - Roblox Creator Hub

1 Like

As other person said, you need to use tween service

Example:

local frame = script.Parent.Frame -- Lets say script is located in screen gui

local TweenService = game:GetService("TweenService")

local StartPos = frame.Position -- Start position of frame (its start location, probably can be offscreen)
local EndPos = UDim2.fromScale(0.1, 0.1) -- Let's say frame is located at 0.1 Scale Y from start and at 0 Scale X at start (Do not really matter where it is located, shouldn't be located at end position either nothing will happen visually)

local TweenDuration = 0.5 -- Seconds

local EndPosTween = TweenService:Create(frame, TweenInfo.new(TweenDuration), {Position = EndPos})
local StartPosTween = TweenService:Create(frame, TweenInfo.new(TweenDuration), {Position = StartPos})

if frame.Position == StartPos then
EndPosTween:Play()
else
StartPosTween:Play()
end
-- I was writing script in this page so thats why if statement is messy
-- Easiest way of tweening thing I think
-- You can modify tween info as you want

This should work, haven’t tested but if you do all right it should work
Also it will work only once, you can bind (connect) the if part to a Activated event and then it will work everytime player clicks on button

Example of connecting if you don’t know:

local button = script.Parent.Button -- again let's say the script will be in screenGUI

button.Activated:Connect(function()

end)
2 Likes