Someone helped me with this before, but I had a hard time changing it. If you do see a problem, please tell me which lines to change. I believe the problem is on lines 13-14. Thanks!
local badgeservice = game:GetService("BadgeService")
local id = 2124574372 --- Put Badge ID here
local MarketplaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductID = 98389501 --- Product ID Here
local function processReceipt(receiptInfo)
local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
badgeservice:AwardBadge(plr. UserId,id)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
---e
MarketplaceService.ProcessReceipt = processReceipt

6 comments
The problem is, when I remove the previous end statement. The word "plr" in line 22, becomes an error.
plr is never defined and look at my post for more info as there is more errors
yes because you used the
plrvariable but you never defined that variable but you did define player use player instead orreceiptInfo.PlayerIdwhich is what i said on discord notplr.UserIdAnother error I was able to find, if you look at the Dev Console it says, "Players:GetUserIdFromName() failed because user doesn't exist". How do you prevent that?
thats a line from a different script, this one doesnt have that line but you probably used the wrong method cuz i cant even find that one but i did find this one GetUserIdFromNameAsync https://developer.roblox.com/en-us/api-reference/function/Players/GetUserIdFromNameAsync
Thanks for the help, but for some reason it still won't award the badge. I don't see any errors, which leaves me wondering why it won't award the badge.