Stuck on Notification System

Hello, I made a basic notification system, however, I’m having an issue when notifications are sent. I’m not really sure how to explain the bug I am having, but it is visible in the top right corner in the game L7_M's Place Number: 201 - Roblox (I made it so the notifications keep popping up so you can see the bug.)

Like how should I make it so the notifications don’t leave gaps or overlap? I’m completely stumbled by this. (I know the notifications aren’t synced up to when someone joins, I currently just have them play every second while I test it)

Script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Folder = ReplicatedStorage:WaitForChild("Notifications")
local Event = Folder:WaitForChild("SetEvent")

local MainFrame = script.Parent
local AlarmFrame = script:WaitForChild("Alarm")
local KillDieFrame = script:WaitForChild("KillDie")
local JoinLeaveFrame = script:WaitForChild("JoinLeave")
local BanFrame = script:WaitForChild("Ban")

local FrameCount = 0

local function UpdateFrames()
	for i,v in pairs(MainFrame:GetChildren()) do
		if v.Name == "Alarm" or v.Name == "KillDie" or v.Name == "JoinLeave" or v.Name == "Ban" then
			local Set = v.Position.Y.Scale
			print(v.Position.Y.Scale)
			local Places = 3
			local Mult = 10^3
			local alt = math.floor(v.Position.Y.Scale*Mult)/Mult
			print(alt)
			if v.Position.Y.Scale <= 0.05 then
				v:Destroy()
				FrameCount = FrameCount - 1
			else
				v:TweenPosition(UDim2.new(0, 0, Set-.075, 0), 'Out', 'Quart', 1)
			end
		end
	end
end

Event.OnClientEvent:Connect(function(Type, Arg)
	if Type == "Joined" then
		local Cloned = JoinLeaveFrame:Clone()
		local Position = FrameCount*.075
		Cloned.Position = UDim2.new(1, 0, Position, 0)
		FrameCount = FrameCount + 1
		Cloned.Parent = MainFrame
		Cloned:TweenPosition(UDim2.new(0, 0, Position, 0), 'Out', 'Quart', 1)
	end
end)

while wait(3) do
	UpdateFrames()
end

A simple way to do it is to add each frame to an array. Then you can use a for loop to check if the frame is overlapping with any other frames. I’ve added a bit of code that you can use as a reference. In this example, the function is called with a table of frames to check. This can be a table of all the frames that you want to check, or you could add the new frame to the table and just check the table to see if the new frame overlaps with the other frames.
local OverlapCheck = function(frames)
for i, frame1 in pairs(frames) do
local frame1Position = frame1.Position
local frame1Size = frame1.Size
for j, frame2 in pairs(frames) do
local frame2Position = frame2.Position
local frame2Size = frame2.Size

        if i ~= j then
            if frame1Position.X.Offset &lt; frame2Position.X.Offset + frame2Size.X.Offset and
                frame1Position.X.Offset + frame1Size.X.Offset &gt; frame2Position.X.Offset and
                frame1Position.Y.Offset &lt; frame2Position.Y.Offset + frame2Size.Y.Offset and
                frame1Position.Y.Offset + frame1Size.Y.Offset &gt; frame2Position.Y.Offset then
                return true
            end
        end
    end
end

end