My leaderstats only works for the deaths, but only for me. The kills do not work at all. The captures work as well.
local leaderstats = Instance.new('Model', player)
leaderstats.Name = 'leaderstats'
local Captures = Instance.new('IntValue', leaderstats)
Captures.Name = 'Captures'
Captures.Value = 0
local Kills = Instance.new('IntValue', leaderstats)
Kills.Name = 'Kills'
Kills.Value = 0
local Deaths = Instance.new('IntValue', leaderstats)
Deaths.Name = 'Deaths'
Deaths.Value = 0
local Players = game.Players
Players.PlayerAdded:Connect(function(player)
wait(1)
local Stats = leaderstats:Clone()
Stats.Parent = player
local Deaths = Stats.Deaths
player.CharacterAdded:Connect(function(Character)
Deaths.Value = Deaths.Value + 1
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.Died:connect(function()
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA("ObjectValue") and Child.Value and Child.Value:IsA("Player") then
local Killer = Child.Value
if Killer:FindFirstChild("leaderstats") and Killer.leaderstats:FindFirstChild "Kills" then
local Kills = Killer.leaderstats.Kills
Kills.Value = Kills.Value +1
end
return
end
end
end)
end
end)
end)
Can you tell me why the kills are not working? Thanks!

1 comment
should I put this instead of the kills and deaths?