Gui transition not working properly

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.)
image

1 Like

you are changing the ImageLabel visibility to false too fast
change to this:

tween.Completed:Connect(function()
    ImageFrame.Visible = false
end)
2 Likes

I do still have a second unanswered question which is how I can make the whole gui scale at once rather than only the image label I used in place of the frame. If anyone else wants to answer that one.

As long as the dependants inside the frame are all sized using the scale property, they will change at the same time and scale as the parent frame when you resize the frame. If they arent, then parent a frame to your image label…you should be using a frame as the parent anyway, not an image label… just parent a frame to your image label and set the size you want to the frame then set the size of your image label to (1,0,1,0).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.