When a player dies in the game, they lose all of their items. I am making a gui that pops up after a player dies that gives them the option to keep the items they have collected if they pay a small robux fee.
How do I do this?
I know how to sell a “keep items” option for game currency. But how do I sell the “keep items” option for robux?
so you need to make a developer product for the game this is something they can buy as much as they want. A gamepass is a one time payment and they keep it
here is the code to let it pop up when you click on it
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local productID = 0000000 -- Change this to your developer product ID
-- Function to prompt purchase of the developer product
local function promptPurchase()
local player = Players.LocalPlayer
MarketplaceService:PromptProductPurchase(player, productID)
end
script.Parent.MouseButton1Click:Connect(promptPurchase)
Thank you! But the product that I am selling is just a few lines of code in my script. I have no “physical” object to sell. Is that okay? Can you sell things in the marketplace that have nothing “real” associated with them?
yes you can, just name it however you want it doesn’t matter, it will just pop up a little screen to buy it, you can find more about developer products here