I don’t know what your wanting but here is an example on how to do it in a server script its pretty much the same way as I show above. I put the script in serverscriptservice. When a player joins in 10 seconds they would get the prompt to buy/get their item.
game.Players.PlayerAdded:Connect(function(player)
wait(10)
local itemId = 5275823807 -- Change to the ID of your item.
game:GetService("MarketplaceService"):PromptPurchase(player, itemId)
end)
How did you do this? In the future, please only mark solutions with the real solution to your issue so others won’t have to make reposts and can benefit from your post as well. Thanks!
This question is not only directed towards you, but more so to UGC Creators. How would it be possible to set the price when rewarding a UGC item? i.e.: Prompting a purchase for free if they accomplish a task provided in-game, but allowing them to purchase it for robux in-game as an alternative. I am not a UGC Creator so this is more confusing. Thanks!
I just played a game that has this choice, (and actually got it this way). You would make a developer product and/or gamepass, and check if they bought it. If they did, you would prompt the free UGC. Thats how most UGC creators go about making it.
No, because you need to let the user buy it. There is no support for making a free and paid version. You can’t force it in their inventory. Only other option is to make 2 Limiteds, one paid one free, but that doesn’t make sense
Is there any way to get the stock of a UGC limited? I don’t want players to be confused and just see the limited not being able to be bought, but have them realize that the stock is all gone. Thanks!
local Market = game:GetService("MarketplaceService") -- Market!
--
local debounce = false -- Ony One Per Time.
--
local ItemID = 0 -- Change With Your ItemID
--
function BuyItem(thing)
if game.Players:FindFirstChild(thing.Parent.Name) and debounce == false then -- Check If Player Exists
debounce = true -- Debounce
local plr = game.Players:FindFirstChild(thing.Parent.Name) -- Set Player To The Player Intance, not the name
print(plr.Name.. " Touched The Part: " ..script.Parent.Name) -- Printer, Can be removed
Market:PromptPurchase(plr, ItemID) -- Purchase!
task.wait(1) -- Debounce
debounce = false -- Same
end
end
function PPFinished(User, BuyedAsset, isPurchased) -- Verify Status Of Player Purchase
if BuyedAsset == AssetID then
if isPurchased then -- If Purchase is sucessfull do things
print("Purchase Completed. AssetID: " ..BuyedAsset.. ", Player: " ..User.Name)
else -- Same but if NOT sucessfull
warn("Purchase Canceled. AssetID: " ..BuyedAsset.. ", Player: " ..User.Name)
end
end
end
script.Parent.Touched:connect(BuyItem) -- Buy Prompt
Market.PromptPurchaseFinished:Connect(PPFinished) -- Prompt Output