I have tried doing this but no luck it just messes up the table
table.remove(KillTable, 1)
The code
local function adjust(clone)
local absSizeY = clone.AbsoluteSize.Y
local gapY = 10
local totalY = absSizeY + gapY
for i,v in pairs(KillTable) do
clone.Name = "Gui"..i
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local tween = tweenService:Create(v, tweenInfo, {Position =UDim2.new(0.9, 0, 0.05, (i-1)*totalY)})
tween:Play()
end
end
function contents:DisplayKill(player, Char, EnemyChar)
local PlayerGui = player:WaitForChild("PlayerGui")
local KillLogGui = PlayerGui:WaitForChild("KillLogGui")
local Template = KillLogGui.Template
local Clone = Template:Clone()
Clone.Parent = KillLogGui
Clone.Name = "KilledGui"
Clone.Visible = true
local TextLabel = Clone.Frame.TextLabel
local textVar = Char.Name.." ".."Has".." "..killMessage[math.random(1, #killMessage)].." "..EnemyChar.Name
TextLabel.Text = textVar
table.insert(KillTable, Clone)
adjust(Clone)
end
local function adjust(clone)
local absSizeY = clone.AbsoluteSize.Y
local gapY = 10
local totalY = absSizeY + gapY
for i,v in pairs(KillTable) do
clone.Name = "Gui"..i
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
local tween = tweenService:Create(v, tweenInfo, {Position =UDim2.new(0.9, 0, 0.05, (i-1)*totalY)})
tween:Play()
end
end
function contents:DisplayKill(player, Char, EnemyChar)
if #KillTable >= 4 then
KillTable[1]:Destroy()
table.remove(KillTable, 1) -- when you call table.remove it shifts all of the elements
adjust(KillTable[1]) -- already iterates throygh everything
end
local PlayerGui = player:WaitForChild("PlayerGui")
local KillLogGui = PlayerGui:WaitForChild("KillLogGui")
local Template = KillLogGui.Template
local Clone = Template:Clone()
Clone.Parent = KillLogGui
Clone.Name = "KilledGui"
Clone.Visible = true
local TextLabel = Clone.Frame.TextLabel
local textVar = Char.Name.." ".."Has".." "..killMessage[math.random(1, #killMessage)].." "..EnemyChar.Name
TextLabel.Text = textVar
table.insert(KillTable, Clone)
adjust(Clone)
end