I have a badge that gives the player a teddy bloxpin gear, but it gives them a million of them, I want it to give them 1.
local badgeservice = game:GetService("BadgeService") local id = (2127329720) script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) badgeservice:AwardBadge(plr.UserId, id) end end) local mps = game:GetService("BadgeService") script.Parent.Touched:connect(function(plr) local player = game.Players.LocalPlayer script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) badgeservice:AwardBadge(plr.UserId, id) game.ServerStorage.TeddyBloxpin:Clone().Parent = player.Backpack game.ServerStorage.TeddyBloxpin:Clone().Parent = player.StarterGear end end) end)
You could try finding that item inside their backpack, and if they already have it, then don't give it to them again. Maybe something like this:
script.Parent.Touched:connect(function(plr) local player = game.Players.LocalPlayer script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if player.Backpack:FindFirstChild("TeddyBloxpin") then print("Player already has TeddyBloxpin.") else local plr = game.Players:GetPlayerFromCharacter(hit.Parent) badgeservice:AwardBadge(plr.UserId, id) game.ServerStorage.TeddyBloxpin:Clone().Parent = player.Backpack game.ServerStorage.TeddyBloxpin:Clone().Parent = player.StarterGear end end end) end)
Edit (Adding a cooldown timer instead):
local debounce = true local debouncetimer = 5 -- set this to how many seconds you want script.Parent.Touched:connect(function(plr) local player = game.Players.LocalPlayer script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if debounce then debounce = false local plr = game.Players:GetPlayerFromCharacter(hit.Parent) badgeservice:AwardBadge(plr.UserId, id) game.ServerStorage.TeddyBloxpin:Clone().Parent = player.Backpack game.ServerStorage.TeddyBloxpin:Clone().Parent = player.StarterGear task.wait(debouncetimer) debounce = true end end end) end)
You could simply fire a Client RemoteEvent that either disables or destroy the script