The updated Math library is a Module Script that allows you to interact with new features!
Why .math()?
Math is one of the libraries that is used most often, so for simplicity and convenience it is used as an updated library.
How to activate the library?
- Get the library Module Script
- Create a request
local math = require(WayToModuleScript)
What new methods does the library offer?
It’s not difficult to figure it out! The Module Script outlines what each function does in simple language with examples.
1
-- Counts all elements in a table / string / number
math.len(target: any): number
2
-- Randomly selects an item based on its chance
math.chance(loot: {}, valueKey: any, chanceKey: any): any
3
-- Always returns a negative number
math.negative(n: number): number
4
-- Turns offset into scale
math.toScale(offset: UDim2): UDim2
-- Turns scale into offset
math.toOffset(scale: UDim2) : UDim2
5
-- Returns the percentage of a number
math.toPrecent(n: number, max: number): number
-- Returns a number from a percentage
math.fromPrecent(precent: number, max: number): number
The Module Script contains a more detailed description of each function!
- Good Luck!