#dev product badge giver doesnt works

107 messages · Page 1 of 1 (latest)

wary dagger
#
proid = 1847030516
badgeid = 4057989400365340
mps.ProcessReceipt = function(recipt)
    if recipt.ProductId == proid then
        if game.Players:FindFirstChild(game.Players:GetNameFromUserIdAsync(recipt.PlayerId)) then
            local plr = game.Players:GetPlayerByUserId(recipt.PlayerId)
            game:GetService("BadgeService"):AwardBadge(plr.UserId,badgeid)
            return Enum.ProductPurchaseDecision.PurchaseGranted
        else
            return Enum.ProductPurchaseDecision.NotProcessedYet
        end
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end```
tidal linden
#

what script did you make that in, server or local?

#

im thinking its either because of wrong proid/badgeid or the script is local

#

since the script should be working

wary dagger
#

not local

tidal linden
wary dagger
tidal linden
#

could you show the output after purchasing the dev prod

wary dagger
#

nah it doesnt gives any output

#

@tidal linden

tidal linden
#

what exactly isnt working btw?

#

its not awarding a badge?

#

its working on my end, only problem could be that you already own the badge since theres no error

tidal linden
wary dagger
wary dagger
#

on npc

#

proximity prompt

#

and it works

tidal linden
#

it also depends on who created the badge

wary dagger
#

nah im sending ss

granite fogBOT
#

studio** You are now Level 7! **studio

tidal linden
#

if you're working on a group owned game, youd have to change the badge creatorship to the group instead of your own acc

wary dagger
#

i created badge on group

#
local mps = game:GetService("MarketplaceService")
proid = 1847030516
badgeid = 4057989400365340
mps.ProcessReceipt = function(recipt)
    if recipt.ProductId == proid then
        if game.Players:FindFirstChild(game.Players:GetNameFromUserIdAsync(recipt.PlayerId)) then
            local plr = game.Players:GetPlayerByUserId(recipt.PlayerId)
            game:GetService("BadgeService"):AwardBadge(plr.UserId,badgeid)
            return Enum.ProductPurchaseDecision.PurchaseGranted
        else
            return Enum.ProductPurchaseDecision.NotProcessedYet
        end
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end```
#

doesnt gives badge

last pelican
wary dagger
#

the issue

last pelican
#

mhm lets see

wary dagger
#

it doesnt gives

last pelican
#

I js came back from helping others lmao

wary dagger
#

the badge

last pelican
#

lemme see

wary dagger
last pelican
#
local mps = game:GetService("MarketplaceService")
proid = 1847030516
badgeid = 4057989400365340
mps.ProcessReceipt = function(recipt)
    if recipt.ProductId == proid then
        if game.Players:FindFirstChild(game.Players:GetNameFromUserIdAsync(recipt.PlayerId)) then
            local plr = game.Players:GetPlayerByUserId(recipt.PlayerId)
            game:GetService("BadgeService"):AwardBadge(plr.UserId,badgeid)
            return Enum.ProductPurchaseDecision.PurchaseGranted
        else
            return Enum.ProductPurchaseDecision.NotProcessedYet
        end
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end```

this is your code, right?
wary dagger
#

Yes

last pelican
#
local mps = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")

local proid = 1847030516
local badgeid = 4057989400365340

mps.ProcessReceipt = function(receipt)
    if receipt.ProductId == proid then
        local player = game.Players:GetPlayerByUserId(receipt.PlayerId)
        if player then
            BadgeService:AwardBadge(player.UserId, badgeid)
            return Enum.ProductPurchaseDecision.PurchaseGranted
        else
            return Enum.ProductPurchaseDecision.NotProcessedYet
        end
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end```

try this
#

@wary dagger

last pelican
wary dagger
#

hm

last pelican
#

bro whats your description btw

wary dagger
#

whats wrong with it

last pelican
#

why are you disrespecting Islam like dat?

wary dagger
#

hell nah

#

i didn't do that brah

#

wtff

last pelican
wary dagger
#

no

last pelican
#

what?

#

any errors?

wary dagger
#

checking rn

tidal linden
#

yeah for some reason it runs perfectly except for the awardBadge method

last pelican
#

I spent an hour on it

#

it turned out that the id was incorrect

wary dagger
#

bro id is truee 😭

#

i send screenshoots

last pelican
tidal linden
#

thing is he pasted the correct id

tidal linden
last pelican
wary dagger
#

no

last pelican
tidal linden
#

man who even uses processReceipt anyways use promptProductPurchased instead lol

#

jk

#

transactions are apparently important yea

last pelican
#

I never use processReceipt

wary dagger
#

this script is in serverscriptservice

#

btw

#

and not local

last pelican
#
local MarketplaceService = game:GetService("MarketplaceService")
local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")

local productId = 1847030516
local badgeId = 4057989400365340

MarketplaceService.ProcessReceipt = function(receipt)
    print("Processing receipt:", receipt)

    if receipt.ProductId == productId then
        local player = Players:GetPlayerByUserId(receipt.PlayerId)
        if player then
            local success, err = pcall(function()
                BadgeService:AwardBadge(player.UserId, badgeId)
            end)
            if success then
                print("Awarded badge to player:", player.Name)
                return Enum.ProductPurchaseDecision.PurchaseGranted
            else
                warn("Failed to award badge:", err)
                return Enum.ProductPurchaseDecision.NotProcessedYet
            end
        else
            warn("Player not found:", receipt.PlayerId)
            return Enum.ProductPurchaseDecision.NotProcessedYet
        end
    else
        warn("Unexpected ProductId:", receipt.ProductId)
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end
#

try this

#

@tidal linden atm im working on a commission, making a party system basically. I spent 10 mins just thinking abt why the code doesnt work, suddenly I remembered that I was using the same remote event for 2 different things, which is why it would duplicate 😝

wary dagger
#

i think it can't see productpurchase

#

there is a one more processreceipt script alsso

#

like it can be broken by it?

#

its same product id

#

it just animates npc

#

on different script

wary dagger
#

is this the issue

tidal linden
#

yeah

#

most likely

wary dagger
#

lol

#

okay i fixed it

#

thank you guys

#

i hope you dont cry later because of 17 mins waste of time

#

the thing i am trying to say is

wary dagger
#

thats all