Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't this Developer Product Purchase not working[Unanswered]?





local Market = game:GetService("MarketPlaceService")

local WalkspeedProductID = 120954837
 
local ReceiptStorage = game:GetService("DataStoreService"):GetDataStore("Receipts", "Market")
 

function PlayerAdded(Player)

Player.CharacterAdded:connect(function(Character)

    local Receipt = ReceiptStorage:GetAsync(tostring(Player.userId))

    if Receipt then

        if Receipt.WalkspeedProductBought then

            Character.Humanoid.MaxHealth = 200

        end

    end

end)

end

 

game.Players.PlayerAdded:connect(PlayerAdded)

 

function GetPlayerByID(id)

    for _, Player in pairs(game.Players:GetPlayers()) do

        if Player.userId == id then

            return Player

        end

    end

end


function Market.ProcessReceipt(ReceiptInfo)

    if ReceiptInfoProductId == tostring(WalkspeedProductID) then

        local Current = ReceiptStorage:GetAsync(tostring(ReceiptInfo.PlayerId))

        if not Current then

            Current = {} 

        end

        Current.WalkspeedProductBought = true

        ReceiptStorage:SetAsync(tostring(ReceiptInfo.PlayerId), Current)

        

        local Player = GetPlayerByID(ReceiptInfo.PlayerId) 

        if Player then

            Player.Character.Humanoid.MaxHealth = 200
        end

      return Enum.ProductPurchaseDescision.PurchaseGranted

    end

end

1 answer

You see how where you put in your product id, well in all the developer product scripts I use to sell mine instead of WalkspeedProductID = 120954837 INSTEAD OF putting WalkspeedProductID TRY putting ProductId thats what all mine say instead of WalkspeedProductID AND try making the D in ID a lowercase that alos might work! If that doesnt work im sorry I tried.

This discussion is preserved as it was. New answers, comments, and votes are closed.