-
This is hard to explain, but I want to make a script that will scale the UI using only it’s original size and a small value, so I can tween all UI’s without having to type out the current size of the UI manually.
-
The issue is, once I hover over the UI and the UI scales, it lowers it’s original size by like 5 and it never comes back to the original size, and I have no idea why that happens.
https://gyazo.com/b839d6a14ed870c19026ec879486fe69?token=8c555eab347318a03bd38011aee4af49 -
I asked my friends and looked on google for solutions, but I didn’t find any.
https://gyazo.com/e141149d290c0daa23e3392b2006236a
I basically want to be able to scale a UI when I hover over it with the mouse but without having to manually type the size of the UI object, instead just give the UI’s size and add some UDim2 size to it to make it bigger / smaller.
for _,button in pairs(script.Parent:GetDescendants()) do
if button:IsA("TextButton") then
local newSize = button.Size + UDim2.new(0,10,0,10)
local newSize2 = button.Size - UDim2.new(0,10,0,10)
local newSize3 = button.Parent.Size - UDim2.new(0,10,0,10)
local newSize4 = button.Parent.Size + UDim2.new(0,10,0,10)
button.MouseEnter:Connect(function()
button:TweenSize(newSize,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true)
button.Parent:TweenSize(newSize4,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true)
end)
button.MouseLeave:Connect(function()
button:TweenSize(newSize2,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true)
button.Parent:TweenSize(newSize3,Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.1,true)
end)
This is my current script, which is just a snippet of my code but that’s the important part.