I am looking to make it so when an AI is killed it rewards everybody with a badge, however currently it only rewards it to whoever got the last hit. My current code is:
local badge = 4045197205634705
local npc = script.Parent
while npc ~= nil do
if npc.Humanoid.Health <= 0 then
local player = npc.Humanoid:FindFirstChild(“creator”)
if npc ~= nil then
if player and player:IsA(“ObjectValue”) and player.Value then
local userId = player.Value.UserId
game:GetService(“BadgeService”):AwardBadge(userId, badge)
end
end
end
wait(1)
end
How can I edit this code to make it so everybody gets the badge?