Okay, so I have a script that will allow you to purchase an in game item, but I'm stuck on how to have the item rewarded to you. I'm awarding cash with this one, how would I do it?
productId = 24209543
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)
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)
