Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with this Developer Products script?

Asked by 9 years ago

when someone buy this it does not give there reward. on this script the Reward it +20 speed

productId = 20636220 -- Replace PRODUCT with the id of your developer product.

local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
    if type(ID) ~= "number" then
    return
    end
    local sets = game:service("InsertService"):GetUserSets(ID)
    for k, v in next, sets do
        if v.Name == "My Models" then
            return v.CreatorName
        end
    end
end
function giveRewards(player)
player.Character.Humanoid.WalkSpeed = player.Character.Humanoid.WalkSpeed + 20
    return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
    giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
    Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)

Answer this question