How would I make this frame slide away with tween?

Hey, everyone!

So I made a main menu, but with my devs we want to make it so it’s slide and don’t make it insta dissapear.

Could you provide me an example of a tween service line about it?

Video:

https://gyazo.com/22ccf2d8ff2c5d09e7781794bc8ea984

We can go in a call if you wish to make this easier, but you must have a:

  1. Working microphone
  2. And you must speak english, just speak it, do not means you have to be english.

For what you want to achieve, you can tween the transparency of the frame to 1, as soon as it is set to 1, you can set Visible to false, and vice-versa.

Heres an example:

local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)

local frame = path.to.frame

local tween = ts:Create(frame, tweenInfo,  { BackgroundTransparency = 1 })
tween:Play()
tween.Completed:Wait()
frame.Visible = false
1 Like

Got it. Where would I put that with my script combined?

Can we just go in a discord call?

image

Right inside MouseButton1Click function.

also this is offtopic, but you can shorten your current code to be:

frame.Visible = not frame.Visible

Heres how you can implement it:

local ts = game:GetService("TweenService")
local debounce = false

script.Parent.MouseButton1Click:Connect(function()
    if debounce then return end
    debounce = true

    local transparency = frame.Visible and 1 or 0

    local info = TweenInfo.new(1, Enum.EasingStyle.Linear)
    local tween = ts:Create(frame, info, { BackgroundTransparency = transparency })
    tween:Play()
    tween.Completed:Wait()
    frame.Visible = not frame.Visible

    debounce = false
end)

We can go in a call if you got this.

Still not working. It’s still normal.

Try increasing the time:

local info = TweenInfo.new(1, Enum.EasingStyle.Linear)

Edit “1” to whatever number you want, that would be the time length of the tween (in seconds).

It’s legit still not tweening.

Maybe the style cause a issue?

Here’s a photo of my main menu.


https://gyazo.com/410938b1754e3243a582e6a7edf78baa

1 Like

Hmm, can you record a little video of how the behavior is, if any errors, can you show the errors in the output screen?

Also, are you sure you want to tween the Background Transparency of the frame?

Of course, give me a minute to do that.

There’s a error:

 MenuFrameA is not a valid member of Frame "Players.achdef.PlayerGui.MainMenu.menuFrameA

Got it.

image

Change this to

local frame = script.Parent.Parent

Also,

image

Use LocalScripts instead of Scripts.

its dont work somehow are you sure about it?

Try something like this @achdef

Frame.AnchorPoint = Vector2.new(0, 0)
Frame.Position = UDim2.new(1.1, 0, 0.178, 0) — Starting Position
wait(0.5)
Frame:TweenPosition(UDim2.new(0.83, 0, 0.178, 0))  — Ending Position
1 Like