hello, can someone help me script it so that if a player kills themself they get kills subtracted and that the least amount of kills a player can get is 0 kills instead of being able to get -x amount of kills
game:GetService("Players").PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Value = 10
kills.Parent = leaderstats
player.CharacterAdded:Connect(function(char)
char:WaitForChild("Humanoid").Died:Connect(function()
local creator = char:WaitForChild("Humanoid"):FindFirstChild("creator")
if creator and creator.ClassName == "ObjectValue" then
local murderer = creator.Value
murderer:WaitForChild("leaderstats"):WaitForChild("Kills").Value += 1
end
end)
if kills.Value >= 10 then
char:FindFirstChild("hat"):Destroy()
game.Lighting.hat1:Clone().Parent = char
end
end)
end)
