So I’m trying to make it so when I press a button it’ll make it so the size of a gui has a smooth transition into being visible, but it only partially works by both not transitioning out at all. But also only the frame itself has been sized up.
Here’s a video showing my problem.
So far I’ve mainly tried different ways of handling the logic like changing the if else statement to both be if visible = false (or true)
-- --Click thingy
wait(1)
local player = game.Players.LocalPlayer
local ImageFrame = player.PlayerGui.ScreenGui.Frame
local visible = false
local Click = player.PlayerGui.BillboardGui2.ImageButton
ImageFrame.Size = UDim2.new(0,0, 0,0)
Click.MouseButton1Click:Connect(function()
local TweenService = game:GetService("TweenService")
if visible == false then
ImageFrame.Visible = true
local tweenInfo = TweenInfo.new(
0.3,
Enum.EasingStyle.Back,
Enum.EasingDirection.Out,
0,
false,
0
)
local tween = TweenService:Create(ImageFrame, tweenInfo, {Size = UDim2.new(0,759, 0,142)})
tween:Play()
visible = true
else
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
0.3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local tween = TweenService:Create(ImageFrame, tweenInfo, {Size = UDim2.new(0,0, 0,0)})
tween:Play()
visible = false
ImageFrame.Visible = false
end
end)
Here’s a screenshot of my workspace if that helps (p.s the frame isn’t an actual frame but an imagelabel I’m using as a frame.)