ive been trying to give a player a badge after finishing an obby, but no solutions are working, anyone know why by any chance? the game is r6 is that matters
game - push the box into the button - Roblox
badge - 2124861392
ive been trying to give a player a badge after finishing an obby, but no solutions are working, anyone know why by any chance? the game is r6 is that matters
game - push the box into the button - Roblox
badge - 2124861392
The question is:
How you scripted it?
The id is correct, but sometimes the script has some small error of a variable or statement
when i had this problem, i used this:
local BadgeService = game:GetService(“BadgeService”)
local Players = game:GetService(“Players”)
local Part = script.Parent
local IDToAward = 2124861392 --Replace this with your BadgeID
local debounce = true
Part.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
if not Player or BadgeService:UserHasBadgeAsync(Player.UserId, IDToAward) or not debounce then
return
end
debounce = false
BadgeService:AwardBadge(Player.UserId, IDToAward)
wait(5)
debounce = true
end)
Your local variable should be defaulted to false.
Your other two debounces should have two equal operators, not one.
local debounce = false
Part.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
if not Player or BadgeService:UserHasBadgeAsync(Player.UserId, IDToAward) or not debounce then
return
end
debounce = false
BadgeService:AwardBadge(Player.UserId, IDToAward)
wait(5)
debounce = false
like this?
local BadgeService = game:GetService(“BadgeService”)
local Players = game:GetService(“Players”)
local Part = script.Parent
local IDToAward = 2124861392 --Replace this with your BadgeID
local debounce = false
Part.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
if not Player or BadgeService:UserHasBadgeAsync(Player.UserId, IDToAward) or not debounce then
return
end
debounce == false
BadgeService:AwardBadge(Player.UserId, IDToAward)
wait(5)
debounce == true
end)
– by 123Fernandoelpro139
local BadgeService = game:GetService(“BadgeService”)
local Players = game:GetService(“Players”)
local Part = script.Parent
local IDToAward = 2124861392 --Replace this with your BadgeID
local Debounce = false
Part.Touched:Connect(function(hit)
if Debounce == false then
Debounce = true
if hit.Parent:FindFirstChild(“Humanoid”) then
if Players:GetPlayerFromCharacter(hit.Parent) then
local Player = Players:GetPlayerFromCharacter(hit.Parent)
if not BadgeService:UserHasBadgeAsync(Player.UserId, IDToAward) then
BadgeService:AwardBadge(Player.UserId, IDToAward)
task.wait(3) – This time cooldown
Debounce = false
else
Debounce = false
end
else
Debounce = false
end
else
Debounce = false
end
end
end)
– try with this
none of these have worked, thanks anyway
--/ Services \--
local BadgeService = game:GetService("BadgeService")
--/ Variables \--
local BadgeAwarder = script.Parent
local BadgeID = 2124861392
--/ Main Script\--
BadgeAwarder.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
if not BadgeService:UserOwnsBadgeAsync(Player.UserId, BadgeID) then
BadgeService:AwardBadge(Player.UserId, BadgeID)
end
end
end)
This should work. This is a LocalScript under the part you want the player to touch to claim the badge!