How to make a coin buy for robux system

Hello! I need help with something, how do I make a system where for example a player wants to buy a tool or some sort but theu don’t have enough money (lets say that the tool costs 150 coins but the plauer only has 100) and instead of going to the store to buy another 100 coins, there will be a popup that says something like “50 more coims needed, buy for 10 robux” so basically the exact amount without the player wasting maybe 50 robux for 100 coins. Thanks

1 Like

Wouldn’t you want them to waste 50 robux more on your game? That’s how you make profit…

Anyway, you’d need to make a bunch of DevProducts and use if statements to check the amount they need (by rounding), and prompt them accordingly.

Something like this: (This is just an example)

local Products = {111111, 222222, 333333} -- Example products.
local Player = -- Player here.

if not Player.leaderstats.Coins.Value == 150 then
    game:GetService("MarketplaceService"):PromptProductPurchase(Products[1])
else
    print("Sword bought!")
end

Again, this is just an example, and is not meant to work, but is just for the sake of showing you somewhat what you’d wanna do! :grin:

2 Likes

You could calculate/get the amount he doesnt have, something like this -

if Player.leaderstats.Cash.Value < Tool.Price.Value then
  local RequiredCash = Tool.Price.Value - Player.leaderstats.Cash.Value 
  --Prompt the product here, and you could also handle the product when he bought it
end