I was recently making my game when I realized that any descendant of a UIGridLayout will not tween size or position. I couldn’t find any post’s that fixed this problem so I figured I should share how I did it.
The best solution that I found was to just make a transparent frame and put whatever UI element you would like to be tweened inside of it.
Example:
If you would like to use the same tween that I used in the video provided, here is the script that I used (Put this inside of what you would like to tween):
local startsize = UDim2.new(script.Parent.Size.Width.Scale, 0, script.Parent.Size.Height.Scale, 0)
local hoversize = UDim2.new(script.Parent.Size.Width.Scale * 1.02, 0, script.Parent.Size.Height.Scale * 1.05, 0) --change 1.05 to whatever works for you
local clicksize = UDim2.new(script.Parent.Size.Width.Scale / 1.8, 0, script.Parent.Size.Height.Scale / 1.8, 0) --change 1.05 to whatever works for you
print(clicksize)
script.Parent.MouseEnter:Connect(function()
script.Parent:TweenSize(hoversize,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.25,true)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent:TweenSize(startsize,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.25,true)
end)
script.Parent.MouseButton1Click:Connect(function()
script.Parent:TweenSize(clicksize,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.25,true)
wait(0.05)
script.Parent:TweenSize(hoversize,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.25,true)
end)
Hope this helps!