So, the problem is here that when you get 1000 kills it awards you with a badge. The script some how is not functioning and doesn't give it to you. It has no errors in the output. This is the script and it's child is an "IntValue" which is the badge giver ID.
local numberofkillsforbadge = 1000
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
handleKillCount(humanoid, player)
end
end
function onPlayerRespawn(property, player)
if property == "Character" and player.Character ~= nil then
local humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end
function getKillerOfHumanoidIfStillInGame(humanoid)
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
local killer = tag.Value
if killer.Parent ~= nil then
return killer
end
end
return nil
end
function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local kills = stats:findFirstChild("Kills")
if killer ~= player then
kills.Value = kills.Value + 1
if kills > numberofkillsforbadge-1 then
print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. player.userId)
local b = game:GetService("BadgeService")
b:AwardBadge(player.userId, script.BadgeID.Value)
end
else
kills.Value = kills.Value - 1
end
end
end
end
