Hello there,
I had this idea of making a custom amount donation board where the player enters their donation amount and they get a prompt for buying a developer product of that amount. The only way to achieve this seems to be by creating developer products from scripts and deleting them after purchase or cancellation.
I made this topic because I wasn’t able to find anything on the wiki.
If you want to create “custom amounts” then just create 1, 5, 10, 50, 100, etc. gamepasses and repeatedly prompt the player to buy the asset. Their total will be equal to the amount they wanted to spend on donating.
While I agree with that. They’re typically used for things such as currency purchases, or getting to continue a game from where you just failed.
The intent wasn’t to be for donations at first, but that’s one of the major uses people have found for them. The way most people do it is just by having increments, 5, 10, 50, 100, 500, 1000.
local Prices = {
100,
50,
10,
5,
1
}
--// Make sure table is sorted highest to lowest
table.sort(Prices, function(A, B)
return A > B
end)
local InputDonation = 123
local Change = {}
for Name, Value in pairs(Prices) do
local Copies = math.floor(InputDonation / Value)
local Remainder = InputDonation % Value
Change[Name] = Copies
if (Remainder == 0) then
break
end
InputDonation = Remainder
end
for i, v in pairs(Change) do
local Price = Prices[i]
print(Price, v) --// you would prompt price "Price" to the player "v" times
end
And the example output would be:
100 1
50 0
10 2
5 0
1 3
And this makes sense because, one 100 + two 10 + three 1 = 100 + 10 + 10 + 1 + 1 + 1 = 123
It should not take more than 3 or 4 products for any reasonable donation depending on your coin values? And if they truly care about donating they are not going to get annoyed over a few prompts. (And even if they are, the highest value prompts must be bought first, so you will get the majority of the donation’s original intent value)
Creating 100000 donation assets just does not seem like a good idea to me :
Hm, if Roblox has a value in player’s data which determines the cost of what the user will buy next in robux, it might just be very simple. No developer products needed. We could just change that value whenever user clicks on buying things. It won’t mess if they cancel.
Just tried the demo place, and it’s still trying to load it, so I don’t think that it’s actually still up and running for their demo place, which could mean that either their security token is outdated, or it’s broken.
Well, for example, User A has a value in him. He enters amount 4769R$ and presses proceed. Then we change value in player by game.Players.LocalPlayer.Value =4769 (suppose) , it triggers purchase prompt for the same amount which is in his value. Now, this happens whenever he clicks for purchasing something. New amount is set and the user buys for that amount and if the purchase is successful, he gets the thing.