Gui Tweening Size Problem

I have a Video to explain this better but all I’m trying to do is tween the size and it’s going to a size of
0,0

watch this to understand and thank you https://vimeo.com/329479621 —the upload was failing when trying to post here

and if you want to see the code here

> local grandmas = script.Parent.Grandmas
> 
> local start = UDim2.new({0, 0},{0, 59})
> 
> local endd = UDim2.new({0, 268},{0, 59})
> 
> grandmas.Pressed.MouseEnter:Connect(function()
> 	
> 	grandmas.MoveFrame:TweenSize(endd, "Out", 'Linear', 1)
> 	
> 	
> end)
> 
> grandmas.Pressed.MouseLeave :Connect(function()
> 	
> 	grandmas.MoveFrame:TweenSize(start, "Out", 'Linear', 1)
> 	
> 	
> end)

I assume it"s going to 0,0 because of your { } surrounding the parameters inside of your UDim2.new calls. Remove those and see what happens.

local start = UDim2.new({0, 0},{0, 59})

local endd = UDim2.new({0, 268},{0, 59})

To

local start = UDim2.new(0, 0, 0, 59)

local endd = UDim2.new(0, 268, 0, 59)

However you should use scale for this, not offset. It will look very bad on a different size viewport.

local start = UDim2.new(0,0,1,0)

local finish = UDim2.new(1,0,1,0)
4 Likes

thank you works great!!!

1 Like

How is

local start = UDim2.new(0,0,1,0)

local finish = UDim2.new(1,0,1,0)

even working that’s so weird

Parameters 1 and 3 are scale (%) values x and y, 2 and 4 are offset (pixel) values x and y.

If you did local finish = UDim2.new(.5,0,1,0) you will notice it will tween half way through as .5 is 50%

1 Like

Your amazing thanks for the helping me understands

1 Like