so I’m working on a game, and i want to award the player a badge when they leave the game.
I have some code to check if i have the badge or not when i join the game again, and it says i do not.
this code isn’t giving the player a badge when they leave:
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")
local badgeId = 1605716020924272 -- this is the correct badge ID
Players.PlayerRemoving:Connect(function(player)
BadgeService:AwardBadge(player.UserId, badgeId)
end)