Kill feed overlapping

So I’m working on a kill feed for my game, and I understand why it’s overlapping. I just don’t really have any idea how to fix it. Here’s the code:

local Event = game.ReplicatedStorage.UISystem2.Killfeed
local dir = "Out"
local style = "Quad"
local dur = 0.5
local replication = script.Parent.Frame.Replicate
local Main = script.Parent.Frame

Event.OnClientEvent:Connect(function(killer,killed)
	
----- Creates a new Frame per kill -----
for i,v in pairs(script.Parent.Frame:GetChildren())do
	if v.Name~= "Replicate" then
local yposition = v.Position.Y.Offset
		v:TweenPosition(UDim2.new(0,0,1,yposition-25),dir,style,dur,true)
	end
end
local newkiller = replication:Clone()
		newkiller.Parent = Main
		newkiller.Visible = true
		newkiller.Killed.Text  = killed
		newkiller.Killer.Text = killer	
		newkiller.Name = "Killer"
newkiller:TweenPosition(UDim2.new(0,0,1,-25),dir,style,dur,true)

local function cleanup()
	local Debris = game:GetService("Debris")
	wait(10)
	newkiller:Destroy()
end

cleanup()
end)

The issue is the fact that it adds -25 to the current y position and tweens it.

local yposition = v.Position.Y.Offset
		v:TweenPosition(UDim2.new(0,0,1,yposition-25),dir,style,dur,true)

meaning whenever you kill someone too quickly and it’s tweened half way, then it grabs the y position of ui and moves it up -25. See here:

what happens when two people trade
image
how it works when people don’t trade
image

Any ideas on how to work around this?

2 Likes

You can just use UIListLayout instead of having to script the position. If you still want a tween effect, put the new frame in another frame and tween the new frame inside the frame.

3 Likes

Instead of waiting 10 you should script the system like so when value is above 2 frames it should delete the first frame also you will have to use timer for how long new player didn’t kill other player so we delete all the frames that were on the screen before.