Problem making a Tweened UiListLayout

Hey! I tried to do a Tweened UiListLayout system but i dont know how to make if a element disappears the other elements position correctly

Here is a example, i want to quit that hole and get down the other alerts

And here is my code (A module):

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")

local EventFolder = ReplicatedStorage.GameStructureEvents
local InfoPreset = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local Info = {
	Info1 = TweenInfo.new(0.08, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
}

-- This script was totally made by Kolda Studio's. --

local WarnModule = {}

function WarnModule:Ad(text, color, borderColor, borderTransparency, typeOfMessage)
	if not typeOfMessage then typeOfMessage = "Normal" end
	if not borderTransparency then borderTransparency = 1 end
	if not borderColor then borderColor = Color3.new(1, 1, 1) end
	if not color then color = Color3.new(1, 1, 1) end
	if not text then return end

	for _, i in pairs(script.Parent.AdsContainer:GetChildren()) do
		if i:IsA("TextLabel") then
			local y = i.Position.Y.Scale-0.07
			local Tween = TweenService:Create(i, Info.Info1, { Position = UDim2.fromScale(i.Position.X.Scale, y) })
			Tween:Play()
		end
	end

	local AdClone = script.Parent:WaitForChild("OtherAd"):Clone()
	AdClone.Size = UDim2.new(0.932, 0, 0.09, 0)
	AdClone.Parent = script.Parent.AdsContainer
	AdClone.Visible = true
	
	AdClone.TextColor3 = color
	AdClone.TextStrokeColor3 = borderColor
	AdClone.TextStrokeTransparency = borderTransparency
	AdClone.Text = text

	TweenService:Create(AdClone, Info.Info1, { Size = UDim2.new(0.932, 0, 0.061, 0) }):Play()
	
	local Ping = script.Parent.Ping:Clone()
	Ping.Parent = game.Workspace
	Ping:Play()
	Ping.Ended:Connect(function()
		Ping:Destroy()
	end)

	if typeOfMessage == "Normal" then

	elseif typeOfMessage == "Shake" then
		local Shaker = require(script.Parent.GuiShakerModule)
		Shaker:ShakeOnce(AdClone, 2, 1)
	end

	wait(15)

	TweenService:Create(AdClone, Info.Info1, { Position = UDim2.new(0.48, 0, AdClone.Position.Y.Scale, 0), TextTransparency = 1 }):Play()
end

return WarnModule

1 Like