Skip to content

K.Rewards ​

Functions ​

K.Rewards.check ​

lua
K.Rewards.check(bundle: any, functionName: string)

Checks a reward bundle, so mistakes show up when the game starts rather than when it's given.

K.Rewards.Describe ​

lua
K.Rewards.Describe(bundle: { [string]: any }): string

A short description like "100 Coins, 3 Red Apple, +1 Strength".

K.Rewards.Fits ​

lua
K.Rewards.Fits(player: Player, bundle: { [string]: any }): (boolean, string?)

True if the player can receive the whole bundle right now (their data is loaded and every item fits). Otherwise false and a reason that can be shown to them.

K.Rewards.Give ​

lua
K.Rewards.Give(player: Player, bundle: { [string]: any }, source: string?): (boolean, string?)

Gives a reward bundle, all or nothing: if it can't all be given (like a full inventory), nothing is given and it returns false with a reason.

K.Rewards.Daily ​

lua
K.Rewards.Daily(days: { any }, options: { AutoClaim: boolean? }?)

Sets up daily rewards: one bundle per day of the streak, starting over after the last. Missing a day resets the streak. Options: AutoClaim (true: given when the player joins).

K.Rewards.ClaimDaily ​

lua
K.Rewards.ClaimDaily(player: Player?): (boolean, string)

Server: ClaimDaily(player). Client: ClaimDaily() asks the server (when AutoClaim is false). Returns (claimed, message).

K.Rewards.DailyStatus ​

lua
K.Rewards.DailyStatus(player: Player?): { Streak: number, Ready: boolean }

Client: your streak and whether today's reward is waiting. Server: DailyStatus(player).

K.Rewards.Code ​

lua
K.Rewards.Code(code: string, bundle: { [string]: any }, options: { Expires: any?, Message: string? }?)

Adds a code players can redeem once each. Codes ignore case and spaces. Options: Expires (a DateTime or os.time() number), Message (shown when redeemed).

K.Rewards.Redeem ​

lua
K.Rewards.Redeem(...: any): (boolean, string)

Server: Redeem(player, code). Client: Redeem(code) asks the server. Returns (redeemed, message).

K.Rewards.Playtime ​

lua
K.Rewards.Playtime(milestones: { [number]: any })

Rewards for minutes played in one session: { [5] = { Coins = 50 }, [30] = { Gems = 2 } }.

K.Rewards.TotalPlaytime ​

lua
K.Rewards.TotalPlaytime(player: Player): number

Seconds the player has played in total, across every session.

Events ​

K.Rewards.Given ​

Server: fires with (player, bundle, source) after any reward is given.

Generated from src/Corode/Rewards.luau.

Corode 0.13.0 · MIT License