How would I prompt a user to buy a limited in-game?

Just a simple question. How would I prompt a user to buy a limited in-game?

To prompt a user to buy a limited in-game item in Roblox, you can use the PromptPurchase function provided by the MarketplaceService service. This function opens a dialog where the user can confirm the purchase of the specified item. Here’s an example of how you can use it:

local Players = game:GetService(“Players”)
local MarketplaceService = game:GetService(“MarketplaceService”)

local userId = Players.LocalPlayer.UserId
local itemId = 12345678 – Replace with the actual Item ID of the limited item

local success, error = pcall(function()
local playerHasItem = MarketplaceService:UserOwnsGamePassAsync(userId, itemId)

if not playerHasItem then
    MarketplaceService:PromptPurchase(userId, itemId)
else
    print("You already own this limited item.")
end

end)

if not success then
warn(“Error:”, error)
end

1 Like

i think this will work i used gamepasses in my games before never limiteds so this is new for me

Never knew I had to use user id.

i mean the pass id/limited id i think that would be more efficient

but if it worked okay don’t need to change anything

I’m not sure what Limited your Prompting

If its your own, you should be fine and can ignore what I’m about to say.

If they are any from the public marketplace/other people limiteds. (I know some games try and caculate the value of people inventories and prompt other peoples limiteds).

You should make sure you can prompt it in your Game with MarketplaceService:GetProductInfo(LimitedID).CanBeSoldInThisGame

All I would recommend and for the most part you should be good :slight_smile:

1 Like

that is true people need to tell more information about what they want how it needs to work etc

1 Like

because that will make it easier to solve the problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.