I want players to be awarded a “Donator” badge regardless of which donation amount they select, but the script I use currently only supports one option. Please help!
-- // Services
local MarketPlace = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
-- // Var
local ProductID = {
2699503706,
2699503784
}
local BadgeID = 4499076816490857
MarketPlace.PromptProductPurchaseFinished:Connect(function (Userid,Product_Id,Purchased)
if Product_Id == ProductID and Purchased then
if not BadgeService:UserHasBadgeAsync(Userid,BadgeID) then
BadgeService:AwardBadge(Userid,BadgeID)
print("earned donator badge!")
end
end
end)
-- // Services
local MarketPlace = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
-- // Var
local ProductID = {
2699503706,
2699503784
}
local BadgeID = 4499076816490857
MarketPlace.PromptProductPurchaseFinished:Connect(function (Userid,Product_Id,Purchased)
if Product_Id == ProductID and Purchased then
if not BadgeService:UserHasBadgeAsync(Userid,BadgeID) then
BadgeService:AwardBadge(Userid,BadgeID)
print("earned donator badge!")
end
end
if Purchased and not BadgeService:UserHasBadgeAsync(Userid,BadgeID) then
BadgeService:AwardBadge(Userid,BadgeID)
end
end)
Edit: Mark this as solved if it fixed your problem so other people know that this is already solved
I had my doubts but this script worked because it feels redundant, but it did work. Is there anything in my original script I should remove or edit in favor of your changes? (I have no idea where the “Purchased” comes from, for starters!)
-- // Services
local MarketPlace = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
-- // Var
local DonationsID = {
2699503706,
2699503784
}
local BadgeID = 4499076816490857
MarketPlace.PromptProductPurchaseFinished:Connect(function (Userid,Product_Id,Purchased)
if table.find(DonationsID, ProductId) and Purchased then
if not BadgeService:UserHasBadgeAsync(Userid,BadgeID) then
BadgeService:AwardBadge(Userid,BadgeID)
print("earned donator badge!")
end
end
end)