You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am making a system that shrinks icons by a factor of two if there are more than 16.
Note:
(While it needs 16 apps to shrink, there are 2 extras due to the UIListLayout and LocalScript running this)
2. What is the issue? Include screenshots / videos if possible!
I can’t figure out how to deal with the odd numbers without messing it up.
that was a bad explanation so basically heres a video of it:
Script:
script.Parent.ChildAdded:Connect(function()
if table.getn(script.Parent:GetChildren()) == 19 then
local tbl = script.Parent:GetChildren()
for _,object in pairs(tbl) do
if object:IsA("Frame") then
object:TweenSize(UDim2.new(object.Size.X.Scale/2,object.Size.X.Offset/2,object.Size.Y.Scale/2,object.Size.Y.Offset/2),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.75)
game:GetService('TweenService'):Create(
object.UIStroke,TweenInfo.new(0.75,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
{Thickness = object.UIStroke.Thickness/2}):Play()
game:GetService('TweenService'):Create(
script.Parent.UIListLayout,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
{Padding = UDim.new(script.Parent.UIListLayout.Padding.Scale/2,script.Parent.UIListLayout.Padding.Offset/2)}):Play()
end
end
end
end)
script.Parent.ChildRemoved :Connect(function()
if table.getn(script.Parent:GetChildren()) < 19 then
local tbl = script.Parent:GetChildren()
for _,object in pairs(tbl) do
if object:IsA("Frame") then
object:TweenSize(UDim2.new(object.Size.X.Scale*2,object.Size.X.Offset*2,object.Size.Y.Scale*2,object.Size.Y.Offset*2),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.75)
game:GetService('TweenService'):Create(
object.UIStroke,TweenInfo.new(0.75,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
{Thickness = object.UIStroke.Thickness*2}):Play()
game:GetService('TweenService'):Create(
script.Parent.UIListLayout,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
{Padding = UDim.new(script.Parent.UIListLayout.Padding.Scale*2,script.Parent.UIListLayout.Padding.Offset/2)}):Play()
end
end
end
end)