> For the complete documentation index, see [llms.txt](https://sprites-organization.gitbook.io/ezstatz-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sprites-organization.gitbook.io/ezstatz-documentation/api-reference/creator-functions.md).

# Creator Functions

Known as constructor functions, these create objects.

### `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.

```lua
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.

{% hint style="info" %}
Most Value objects are not supported at this time, however more support will come as updates follow.
{% endhint %}

| Parameter Name | Value Object |
| -------------- | ------------ |
| int            | IntValue     |
| str            | StringValue  |

#### Example

```lua
-- Creating an integer based value
local cash = Ezstatz:createValue(player, "Cash", "int")

-- Creating a string based value
local rank = Ezstatz:createValue(player, "Rank", "str")
```
