I'm making a tag game, and I have a script that should award a badge if you tag a developer, and kill you if you're tagged. It uses tools. But, after this new update with a badge, it spams the output/dev console with "TooManyRequests". Please help!
local Humanoid = script.Parent:WaitForChild("Humanoid")
function award(plr)
if not game.BadgeService:UserHasBadgeAsync(plr.UserId, 2124571974) then
game.BadgeService:AwardBadge(plr.UserId, 2124571974)
end
end
script.Parent.Torso.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local currentplayer = game.Players:GetPlayerFromCharacter(script.Parent)
if player then
if hit.Parent.Name == "Tool" then
Humanoid:TakeDamage(1000000)
end
if player.UserId == 111255307 then
award(currentplayer)
elseif player.UserId == 424716966 then
award(currentplayer)
elseif player.UserId == 109352342 then
award(currentplayer)
end
end
end)
while true do
wait(0.1)
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end

1 comment
the Touched event may fire multiple times in a very short amount of time so if all the requirements are met (the right userId) etc the award function will then try and award the badge a bunch of times in a very short amount of time, hence why your probably getting this error.