Codes Module V2!

So, a while back I made CodeModule a while back, it was a disaster. It only had one function and that was it.

Well a few weeks ago, I made this, and was just having some issues with the code. That now were resolved.
Most stuff from back then still apply’s here. I might make a better tutorial on how to use the Codes Module v2. But for right now, you should understand that it has the same idea behind it. It’s very based around the old module, but the mainModule being re-made, with its functions too.

So instead of just using the horribly named :canBeRedeemed() now you would use:

:canBeRedeemed(plr, input)

To check if a player can redeem a code. It will return true if that player never redeemed it.
It will result false, if it can’t be. Also now this function is NECESSARY when using your code. It needs to be done before :RedeemCode() and with that, let’s go to:

:RedeemCode(plr, input)

This redeems the code for you and gives you some info, like

{
    Redeemable = boolean,
    Reward = variable,
    ErrorCode = A1 to A6
}

Inside the main module you’ll see ErrorCodes as another “module”. You can require it and get the message behind the error code. Like a1 is “Sucessfully redeemed!” and so on.

Rules:

  1. Datastores ENABLED!

  2. You’ll have to implement the system yourself. This only gives you an automated system for you to use.

  3. canBeRedeemed() ABSOLUTELY needs to FIRED before RedeemCode(), canBeRedeemed will cache the info from a data store, and redeemcode will use that info instead of requesting it again. I made it this way to encourage people to use canBeRedeemed();

6 Likes