Badge help, roblox limitations?

need help with a badge script, could it be roblox limitations

local success, result = pcall(function()
			for i,v in pairs(game.Players:GetPlayers()) do
				if not game:GetService("BadgeService"):UserHasBadgeAsync(v.UserId, 3453650378693728) then
					game:GetService("BadgeService"):AwardBadge(v.UserId, 3453650378693728)
					
				end
				v.data.Points.Value += 1000
			end
		end)
if success then
	print("yeepee")
else
	warn('wata')
end

is the script yet some ppl complain they dont get badge but for me they worked first time.

forgot to add the pcall function, editing msg.

Try this script. All I changed is I made it run every single time a player was added, also making sure to loop through every player again to make sure. If it doesn’t succeed with awarding the badge, it will warn the error message the pcall() produces, then restart the pcall().

local function RewardBadge(Player)
	print(Player)
	
	local Success, ErrorMessage = pcall(function()
		task.wait()
		
		if not game:GetService("BadgeService"):UserHasBadgeAsync(Player.UserId, 3453650378693728) then
			game:GetService("BadgeService"):AwardBadge(Player.UserId, 3453650378693728)
		end
		
		Player:WaitForChild("data").Points.Value += 1000
	end)
	
	if not Success then
		warn(tostring(ErrorMessage))
		
		RewardBadge(Player)
	end
end

game:GetService("Players").PlayerAdded:Connect(function(Player)
	RewardBadge(Player)
	
	for Index, Player in pairs(game:GetService("Players"):GetPlayers()) do
		RewardBadge(Player)
	end
end)

Hi, the script wasn’t the issue, I was disabling the script before awarding the badge :sweat_smile: it’s supposed to be a story mode but I fixed it now

1 Like

Oh ok, good job on fixing it! Good luck on your project!

1 Like