Hello Developers! I have a small problem. I don’t really know how to do something like merch codes. I want 75 and all of them are stored in a table/folder. Does anyone know how I can do this? (It should only be redeemable once in the entire world)
Thank you for any reply!
Datastores. Need I say more?
Once one is redeemed it saves a value saying, yup its redeemed.
If someone tries to redeem the code it checks if it is already redeemed.
You can store all codes in a single table that is saved to the datastore like this
local codes = {
"CODENAME" = true -- if true then its been redeemed, if false it hasnt.
"Frog" = false -- it hasnt been redeemed
}
-- then all you need to do is save this table in a datastore, when a player tries to redeem a code check this datastore get the code they tried to redeem, if its false redeem it! If not dont. Pretty simple I think
1 Like
That would not be feasible for all applications. For example, if I have a rather large player base and would like to hand out copious amount of codes(roughly in the thousands) simply storing them in a dictionary and checking if it has been redeemed or not could be a very tedious process. I suggest developing an algorithm that generates the codes following a very specific and complex rule set and having the game ensure the code inputted follows the same algorithm.
1 Like