I have a kill feed module set up, and have everything to make it work set up as well. Basically, when the server sees that a player who was being shot at dies, it fires to all clients information such as the player’s name, dead player’s name, and gun’s name. From there, in a client script in StarterPlayerScripts uses the module to create a new index in the killfeed.
here’s the module
local contents = {}
local tweenService = game:GetService("TweenService")
local debris = game:GetService("Debris")
local KillTable = {}
local function adjust(clone)
local absSizeY = clone.AbsoluteSize.Y
local gapY = 2
local totalY = absSizeY + gapY
for i,v in pairs(KillTable) do
clone.Name = "Gui"..i
local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear)
local tween = tweenService:Create(v, tweenInfo, {Position =UDim2.new(0.35, 0, 0.05, (i-1)*totalY)})
tween:Play()
end
end
function contents:DisplayKill(player, Char, Gun, EnemyChar)
if #KillTable >= 8 then
KillTable[1]:Destroy()
table.remove(KillTable, 1)
adjust(KillTable[1])
end
local PlayerGui = player:WaitForChild("PlayerGui")
local KillLogGui = PlayerGui:WaitForChild("KillLogGui")
local Template = KillLogGui.Frame.Template
local Clone = Template:Clone()
Clone.Parent = KillLogGui
Clone.Name = "KilledGui"
Clone.Visible = true
local TextLabel = Clone.Frame.TextLabel
local textVar = Char.." "..Gun.." "..EnemyChar
TextLabel.Text = textVar
table.insert(KillTable, Clone)
adjust(Clone)
wait(7.5)
KillTable[1]:Destroy()
table.remove(KillTable, 1)
adjust(KillTable[1])
end
return contents
and here’s the client script in StarterPlayerScripts
local repstore= game:GetService("ReplicatedStorage")
local KillFeed = require(repstore:WaitForChild("KillFeed"))
local plr = game.Players.LocalPlayer
repstore.Killfeed.OnClientEvent:Connect(function(plrname, gun, deadman)
KillFeed:DisplayKill(plr, plrname, gun, deadman)
end)
This all works, but the problem is, the player who dies doesn’t see the killfeed index, and if the player that killed that player dies soon after, the killfeed also disappears for them. Where should I store each index/how should I resend the same information to the dead players?