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
how it works when people don’t trade
Any ideas on how to work around this?