Like a code reward system, but this one the code can be used only one time, so only the first player that uses it gets the reward
Two players can’t use the same code and the same player can’t use it twice, just one use for all the game
Like a code reward system, but this one the code can be used only one time, so only the first player that uses it gets the reward
Two players can’t use the same code and the same player can’t use it twice, just one use for all the game
What are you asking? We are not going to write the entire code for you
He is asking for like a special code system, it is only redeemable once and only usable by ONE player
The question is more what problems the poster is having with creating one themselves? Do they need a breakdown of the concepts required? Have they tried something and it’s failed?
Without context it seems like the poster is asking for someone to write it for them, even if they don’t mean for it to sound like that.
You could store all your codes in a datastore table and make it so if the code inputted exists and is one of your exclusive ones, it is removed from the datastore once redeemed so therefore the next time a player tries to redeem it and you search in the datastore it won’t exist and the other player won’t be able to redeem it. You’ll have to watch out to make sure you’re not requesting too often, maybe add a brief 3-5 second cooldown to redeeming codes.
Store all your codes in a datastore, and anytime a player submits a code, check that the code exists, and that it already hasn’t been redeemed.
If it does, reward the player accordingly.
Someone recommended for the code to be removed from the datastore when it is redeemed, but I don’t advise this for logging reasons.
An arguably better approach is this:
Few things to keep in mind:
MessagingService
to relay to all the servers that a code was redeemed, and get them to update their caches accordingly.game:BindToClose()
.Another (kind of) critical thing to note of:
You may encounter a race condition where two players submit the same code in a very short time between one another, resulting in both players being rewarded.
You may want to artificially wait for a short time after a code has been submitted, to ensure that MessagingService
has time to relay that a code has been redeemed from another server.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.