Hello! I am making a UI tween asset, and I am figuring out if there’s a better way to do this
local TS = game:GetService("TweenService")
local info = TweenInfo.new(.25, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut) -- Changeable, number is how much sec it'll take to complete the animation
local Settings = {
["Transparency"] = {true, 0.5}; -- makes gui transparent, change num for transparency, 0 being none, 1 being max
["Rotation"] = {true, 15}; -- Rotates button, change num for rotation
["Smaller"] = true;
["Bigger"] = true;
}
local gui = script.Parent:GetDescendants()
for i, buttons in gui do
if buttons:IsA("TextButton") or buttons:IsA("ImageButton") then
buttons.MouseEnter:Connect(function()
if Settings["Transparency"] then
TS:Create(buttons, info, {Transparency = Settings["Transparency"][2]}):Play()
end
if Settings["Rotation"] then
TS:Create(buttons, info, {Rotation = Settings["Rotation"][2]}):Play()
end
end)
buttons.MouseLeave:Connect(function()
if Settings["Transparency"] then
TS:Create(buttons, info, {Transparency = 0}):Play()
end
if Settings["Rotation"] then
TS:Create(buttons, info, {Rotation = 0}):Play()
end
end)
end
end