πŸ–₯️API Reference

Creator Functions

createLeaderstatsObject(player: Player): Folder

Creates a Leaderstats folder into the specified Player object and returns it.

Example

The code below will create a new leaderstats object each time a player joins the game, and will print it's Name property and the Player's name that the Folder is being parented to.

local Ezstatz = require(game.ServerScriptService:WaitForChild("Ezstatz"))

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Ezstatz:createLeaderstatsObject(player)
    print(leaderstats.Name, player.Name)
end)

createValue(player: Player, name: string, valType: valueType): ValueBase

Creates and returns a Value based on the given valType

Below is a list of Value objects currently supported by the valType parameter.

circle-info

Most Value objects are not supported at this time, however more support will come as updates follow.

Parameter Name
Value Object

int

IntValue

str

StringValue

Example


Getter Functions

getLeaderstats(player: Player): Folder

Returns a Player's leaderstats folder if they have one.

Example


Setter Functions

set(player: Player, name: string, value: any)

Sets the given Player's value of name to the specified value

Example

circle-exclamation

incrementValue(player: Player, name: string, delta: number)

Increases the Player's provied stat name by the provided delta number.

Example

decrementValue(player: Player, name: string, delta: number)

Similar to incrementValue(), except it decreases.

Example


Comparison Functions

isGreaterThanOrEqual(player: Player, value, num): boolean

Returns whether or not value's value is greater than or equal to num.

Example

isLessThanOrEqual(player: Player, value: ValueBase, num: number): boolean

Same as isGreaterThanOrEqual(), however it'll do the exact opposite, instead checking if the provided value is less than or equal to num.

Example

isGreaterThan(player: Player, value: ValueBase, num: number): boolean

Returns true if the given value's Value property is greater than num. Otherwise, returns false.

Example

isLessThan(player: Player, value: ValueBase, num: number): boolean

Similar to isGreaterThan(), it will instead return true if the value's Value property is less than num

Example


Data Functions

circle-check
circle-exclamation

getData(player: Player): {any}

Returns the provided Player's leaderboard data.

circle-exclamation

Example

saveData(player: Player)

Saves all of the current values inside of the Player's leaderstats folder into the datastore.

circle-exclamation

Example

eraseData(player: Player): {any}

Clears a Player's Datastore key if there's any data present within it.

circle-exclamation
triangle-exclamation

Example

Last updated