# Functions Core

### Round All values Func

{% code title="RoundValues" overflow="wrap" %}

```lua
-- client and serverside
tonumber(roundValue(CashSet, 2)) -- ex: 0.28$
tonumber(roundValue(GoldSet, 2)) -- ex: 1.22g
tonumber(roundValue(XpSet, 1))   -- ex: 100 XP
tonumber(roundValue(ItemQuantity, 1)) -- 1

-- The function prevent (1.5898789875725$) or -1 or wrong values showed and respect the decimal 0.00$ or decimal for gold 0.00g or int for xp 0xp
```

{% endcode %}

### Random Int Value Func

{% code title="Random Value with Integer" overflow="wrap" %}

```lua

-- ClientSide
MyRandomInt = RandomInt(max)
-- return number 0 > your number

-- ServerSide
local MyRandomInt = exports.infinity_core:RandomInt(maxvalue)
-- return number 0 > your number

```

{% endcode %}

### Get Player Current Town Position

{% code title="Get Player Towns location" overflow="wrap" %}

```lua
-- ClientSide Only
local MyCurrentTown = GetTownPlayer()
or    MyCurrentTown = exports.infinity_core:GetTownPlayer()Pos
-- return ex: Valentine
```

{% endcode %}
