Skip to main content

Util

Install with wally by adding the following to your wally.toml:

Util = "dig1t/util@1.0.19"

Types

ValueBaseType

type ValueBaseType = ValueBase & {Valueany}

This is a custom type to represent and typecheck value instances.

Roblox has a built-in ValueBase type, but it does not have a Value property.

Example:

local value: ValueBaseType = Instance.new("BoolValue")

Properties

userLevel

Util.userLevel: table<number,number>

Functions

getPartCount

Util.getPartCount(instanceInstance) → number

Gets the number of parts in the given instance

Example:

Util.getPartCount(game.Workspace.NPC) -- 5

getDescendantParts

Util.getDescendantParts(instanceInstance) → {BasePart}

Gets all parts in the given instance

Example:

Util.getDescendantParts(game.Workspace.LightPost) -- { [1] = Light, [2] = PostMeshPart }

getAncestor

Util.getAncestor(
childInstance,
conditionstring | (objInstance) → boolean
) → any

Gets the first descendant of the given instance that matches the given condition. This will search all descendants of the given instance, including the instance itself. It will stop if no ancestor is found.

Example 1:

detector.Touched:Connect(function(part: BasePart)
	local humanoid = Util.getAncestor(part, "Humanoid")

	if humanoid ~= nil then
		print("Humanoid touched the detector")
	end
end)

Example 2:

detector.Touched:Connect(function(part: BasePart)
	local bot: Model? = Util.getAncestor(part, function(instance: Instance)
		return instance:HasTag("NPC")
	end)

	if bot ~= nil then
		bot.
		print("NPC bot touched the detector")
	end
end)

find

Util.find(
nodeInstance | {[any]any},
conditionstring | (objInstance) → boolean,
maxDepthnumber,--

Default: 1

_depthnumber--

Internal use, used to track the current depth

) → any

Starts at the given node and searches all children for the first child that matches the given condition. This search will continue until maxDepth is reached, a match is found, or no more children are found. When a match is found, it will return the matching child. When no match is found, it will return nil.

By default maxDepth is 1. Only the children of the given node will be searched.

Function condition example:

local player: Player? = Util.find(game.Players, function(player: Player)
	return player.Name == "Player1"
end)

Instance example:

local player: Player? = Util.find(game.Players, "Player1")

Filtering example:

local NPCs = {
	{ Name = "NPC1" },
	{ Name = "NPC1" },
	{ Name = "NPC1" },
}

local player = Util.find(NPCs, function(NPC)
	return NPC.Name == "NPC1"
end)

Advanced example:

local NPCs = {
	{ Name = "NPC1", Health = 0 },
	{ Name = "NPC1", Health = 20 },
	{ Name = "NPC1", Health = 0 },
}

local firstAliveNPC = Util.find(NPCs, function(NPC)
	return NPC.Health > 0
end)

exists

Util.exists(
nodeInstance | {[string]any},
childrenstring | {string}
) → boolean

Checks if the given instance has the children with the given key names. A single child name can be passed as a string, or multiple child names can be passed as a table.

Table of children example:

Util.exists(
	game.Workspace.Player1,
	{ "Head", "Torso", "Left Arm", "Right Arm", "Left Leg", "Right Leg" }
) -- true

String child example:

Util.exists(game.Workspace.Player1, "Head") -- true

Table of children in a table node example:

Util.exists(
	game.Workspace.Player1:GetChildren(), -- table
	{ "Head", "Torso" }
) -- true

Table node and string child example:

Util.exists(
	game.Workspace.Player1:GetChildren(), -- table
	"HumanoidRootPart"
) -- true

getFirstPart

Util.getFirstPart(instanceInstance) → BasePart?

Returns the first part in the given instance

Example:

Util.getFirstPart(game.Workspace.Player1) -- Head

round

Util.round(_numbernumber) → number

Rounds a number to the nearest integer.

Example:

Util.round(1.5) -- 2
Util.round(1.4) -- 1

formatNumber

Util.formatNumber(
numbernumber,
decimalsnumber?--

The number of decimal places to round to. Defaults to 2.

) → string

Formats a number to have commas.

Example:

Util.formatNumber(1000) -- 1,000
Util.formatNumber(1000.01) -- 1,000.01

random

Util.random(
minValuenumber,
maxValuenumber?,
floatboolean?--

Whether to return as a float or not. Defaults to false.

) → number

Returns a random number between two numbers.

Example:

Util.random(1, 10) -- 5
Util.random(1, 10, true) -- 5.5
Util.random(10) -- 5 (min defaults to 1)
Util.random(10, true) -- 5.5 (min defaults to 1)

randomString

Util.randomString(
lengthnumber?--

Length of the string (defaults to 18)

) → string

Returns a random string.

Example:

Util.randomString() -- "aBcDeFgHiJkLmNoPqRsTuVwXyZ"
Util.randomString(10) -- "aBcDeFgHiJ"

randomObj

Util.randomObj(objtable | Instance) → any

Returns a random object from a table or instance.

Example:

Util.randomObj({ "a", "b", "c" }) -- "b"
Util.randomObj(Workspace.Player) -- Head

coinFlip

Util.coinFlip() → boolean

Returns a random boolean.

Example:

Util.coinFlip() -- true
Util.coinFlip() -- false

shortenNumber

Util.shortenNumber(
numbernumber | string,
minimumTiersnumber?,--

The minimum number of tiers to shorten. Defaults to 1.

decimalsnumber?--

The number of decimal places to round to. Defaults to 1.

) → string

Shortens a large number to a readable format. Useful for displaying large numbers that don't require exact precision. Common use cases are for displaying XP, money in leaderboards, damage etc.

Example:

Util.shortenNumber(1000) -- 1K
Util.shortenNumber(1000000) -- 1M
Util.shortenNumber(1000000000) -- 1B
Util.shortenNumber(1000000000000) -- 1T
Util.shortenNumber(1000000000000000) -- 1Q

minimumTiers is useful for when you want to shorten a number but only if it's above a certain tier. For example, if you want to shorten a number but only if it's above 1,000,000, you would do:

Util.shortenNumber(1000000, 2) -- 1,000,000

A tier is the amount of commas in a number. For example, 1,000,000 has 2 tiers and 1,000 has 1 tier.

Tier list and their abbreviations:

  • 1,000 = K
  • 1,000,000 = M
  • 1,000,000,000 = B
  • 1,000,000,000,000 = T
  • 1,000,000,000,000,000 = Q

getVector3

Util.getVector3(objectVector3 | CFrame | Instance) → Vector3?

Gets a Vector3 from an object containing a Vector3 or CFrame.

Supports:

  • Vector3
  • CFrame
  • Attachment
  • BasePart
  • CFrameValue
  • Vector3Value
  • Camera

getDistance

Util.getDistance(
originVector3 | Instance,
targetVector3 | Instance
) → number

Gets the distance between two Vector3s.

getPartBottomSurface

Util.getPartBottomSurface(partBasePart) → CFrame

Gets the bottom surface of a part.

getGroupRank

Util.getGroupRank(
playerPlayer,
groupIdnumber
) → number

Gets the group rank of a player.

Example:

Util.getGroupRank(game.Players.LocalPlayer, 1) -- 255

isCreator

Util.isCreator(playerPlayer) → boolean

Checks if a player is the creator of the game.

Example:

Util.isCreator(game.Players.LocalPlayer) -- true

getUserLevel

Util.getUserLevel(playerPlayer) → number

Gets the user level of a player.

Example:

Util.getUserLevel(game.Players.LocalPlayer) -- 0
Util.getUserLevel(game.Players.GameDeveloper) -- 4
Util.getUserLevel(game.Players.PremiumPlayer) -- 4
Util.getUserLevel(game.Players.Creator) -- 5

getHumanoid

Util.getHumanoid(objectInstance?) → Humanoid?

Gets the humanoid object from a player's character part, character model, player object, or humanoid.

Example:

Util.getHumanoid(game.Players.LocalPlayer) -- Humanoid

isAlive

Util.isAlive(objInstance?) → boolean

Checks if a humanoid is alive. If no humanoid is found, it will return nil

Example:

Util.isAlive(game.Players.LocalPlayer) -- true
Util.isAlive(game.Workspace.Zombie) -- false
Util.isAlive(game.Workspace.Part) -- nil, but will throw a warning

hasHumanoid

Util.hasHumanoid(objInstance?) → boolean

Checks if an object has a humanoid.

Example:

Util.hasHumanoid(game.Players.LocalPlayer) -- true
Util.hasHumanoid(game.Workspace.Zombie) -- true

getCharacterFromInstance

Util.getCharacterFromInstance(instanceInstance?) → Model?

Gets the character model from a BasePart.

Useful for getting the character model from a Touched event or a raycast.

Example:

local rig: Model? = Util.getCharacterFromInstance(hit.Part)
local rigPlayer: Player? = Players:GetPlayerFromCharacter(rig)

getPlayerFromInstance

Util.getPlayerFromInstance(instanceInstance) → Player?

Gets the player object from a BasePart.

Example:

Util.getPlayerFromInstance(game.Workspace.Part) -- Player

dateTimeComponentsToTimestamp

Util.dateTimeComponentsToTimestamp(componentsDateTimeComponents) → number

Converts a DateTimeComponents table to a timestamp.

unix

Util.unix() → number

Get the current unix timestamp in UTC time. This is the number of seconds since January 1, 1970.

timeAgoUnix

Util.timeAgoUnix(
timestampnumber?,
endTimestampnumber?--

The timestamp to compare to. Defaults to current time.

) → number

Gets the time in seconds since now or the provided timestamp.

formatUnix

Util.formatUnix(
timestampnumber,
formatstring,--

The format to use.

localestring?,--

The locale to use. Defaults to en-us.

useUTCboolean?--

Whether to use UTC time. Defaults to local time.

) → string--

The formatted time in local time.

Converts a unix timestamp to a mm:ss format (e.g. 00:02). A format and locale can be provided.

Use the DateTime API for formatting options.

Example

local secondsLeft: number = 80

Util.formatUnix(secondsLeft, "mm:ss", nil, true) -- 01:20
Util.formatUnix(secondsLeft, "HH:mm:ss", nil, true) -- 00:01:20

elapsedTimeClockFormat

Util.elapsedTimeClockFormat(timestampnumber) → string--

The formatted time in local time.

Converts a unix timestamp to a mm:ss format (e.g. 00:02).

Example

Util.elapsedTimeClockFormat(80) -- 01:20
Util.elapsedTimeClockFormat(3661) -- 01:01:01

timeAgo

Util.timeAgo(
timestampnumber,
endTimestampnumber?--

The timestamp to compare to. Defaults to current time.

) → string

Converts a unix timestamp to a readable time ago format (e.g. 1 minute ago, 1 minute 20 seconds ago).

Example

local secondsLeft: number = 80

Util.timeAgo(secondsLeft) -- 1 minute ago
local secondsLeft: number = 80

Util.timeAgo(secondsLeft, 80 + 60) -- just now

totalTime

Util.totalTime(
timestampnumber,
endTimestampnumber?,--

The timestamp to compare to. Defaults to current time.

separatorstring?,--

The separator to use between each unit. Defaults to a space.

depthnumber?--

The maximum number of units to return.

) → string

Similar to Util.timeAgo but returns a more detailed string with the total time instead of the largest unit. Convert a unix timestamp to a readable format (1 days, 1 hours, 1 minutes, 1 seconds).

Example

local secondsLeft: number = 80

Util.totalTime(secondsLeft) -- 1 minute 20 seconds

use

Util.use(moduleNamestring | ModuleScript) → ()

Injects a module into the Util module.

Example:

-- Before
Util.requiredFunction() -- error: "Function not found"

-- After
local pathToModule: ModuleScript = script.Parent.Module
Util.use(pathToModule)

Util.requiredFunction() -- "Hello world!"

printTable

Util.printTable(source{[any]any}) → ()

Prints a JSON string to the console using HttpService.

Example:

Util.printTable({
	foo = "bar";
	bar = "foo";
}) -- {"foo":"bar","bar":"foo"}

numberSequence

Util.numberSequence(data{any}) → NumberSequence

Create a new NumberSequence from a table of keypoints.

Example:

local gradient: ColorSequence = Util.colorSequence({
	{ 0, Color3.fromRGB(255, 0, 0) };
	{ 1, Color3.fromRGB(0, 255, 0) };
})

local particle: ParticleEmitter = Instance.new("ParticleEmitter")
particle.Color = gradient

getProductInfo

Util.getProductInfo(
productIdnumber,
infoTypeEnum.InfoType?
) → {[any]any}?

Retrieves product info with the Roblox marketplace API.

getAssetURI

Util.getAssetURI(
assetId(number | string)?,
fallbackAssetId(number | string)?
) → string

Returns an asset URI.

Example:

Util.getAssetURI("rbxassetid://1234567890") -- rbxassetid://1234567890
Util.getAssetURI(1234567890) -- rbxassetid://1234567890

-- Fallback URIs
Util.getAssetURI(nil, "rbxassetid://1234567890") -- rbxassetid://1234567890 (fallback)
Util.getAssetURI(nil, 1234567890) -- rbxassetid://1234567890 (fallback)

attempt

Util.attempt(
runner() → (),
maxTriesnumber?,--

Defaults to 3

yieldnumber?
) → (
boolean,
any,
number
)

Calls the given function until it successfully runs. Useful for retrieving from a data store or GET/POST requests.

It will return a tuple of (success: boolean, result: any, tries: number).

Example:

local success: boolean, result: any, tries: number = Util.attempt(function()
	return game:GetService("HttpService"):GetAsync("https://example.com")
end)

print(success, result)
print(`It took {tries} tries to retrieve the data`)

try

Util.try(
runner() → (),
catch(any) → ()
) → any

Simple try catch function.

Example:

local result: any = Util.try(function()
	return "Hello world!"
end, function(err)
	warn("Error: " .. err)
end)

print(result) -- "Hello world!"

Example:

local result: any = Util.try(function()
	error("Something went wrong")
end, function(err)
	warn("Error: " .. err)
end)

print(result) -- nil

weld

Util.weld(
partBasePart,
attachToBasePart,
offsetCFrame?
) → WeldConstraint

Welds 2 parts together.

Example:

local weld: WeldConstraint = Util.weld(game.Workspace.Car.Wheel, game.Workspace.Car)

weldModel

Util.weldModel(modelModel) → Model?

Welds all parts in a model to the PrimaryPart if it is set.

Example:

Util.weldModel(game.Workspace.Car)

clearWelds

Util.clearWelds(instanceInstance) → ()

Clears all welds from an instance.

Example:

Util.clearWelds(game.Workspace.House)

breakJoints

Util.breakJoints(instanceInstance) → ()

Clears all joints from an instance.

Example:

Util.breakJoints(game.Workspace.House)

getMass

Util.getMass(modelModel) → number

Gets the mass of a model.

waitForChild

Util.waitForChild(
parentInstance,
namestring
) → Instance?

Wait for a child to be added to an instance. WARNING: This function will forever wait until the child is added.

waitForPrimaryPart

Util.waitForPrimaryPart(
modelModel,
timeoutnumber?--

Defaults to 15 seconds

) → BasePart?

Wait for the primary part of a model to be set.

addListener

Util.addListener(
instanceInstance,
listenerTypestring,--

"Property" | "Attribute"

listenTostring,--

The property or attribute to listen to

callback(
any,
any
) → ()--

The callback to run when the property or attribute changes

) → RBXScriptConnection

Expiremental

Listens to a property or attribute on an instance and runs a callback when it changes. It will return a connection that can be disconnected.

Using addListener() is an addition to Roblox's built-in GetPropertyChangedSignal() and GetAttributeChangedSignal().

The callback will be called with the previous value and the new value.

Example:

local connection = Util.addListener(
	game.Workspace.NPC,
	"Health",
	"Attribute",
	function(oldValue, newValue)
		print("Health changed from " .. oldValue .. " to " .. newValue)
	end
)

addPropertyListener

Util.addPropertyListener(
instanceInstance,
listenTostring,
callback(
any,
any
) → ()
) → RBXScriptConnection

Shortcut for Util.addListener

Example:

local connection = Util.addPropertyListener(game.Workspace.NPC, "Name", function(oldValue, newValue)
		print("Name changed from " .. oldValue .. " to " .. newValue)
	end
)

addAttributeListener

Util.addAttributeListener(
instanceInstance,
listenTostring,
callback(
any,
any
) → ()
) → RBXScriptConnection

Shortcut for Util.addListener

Example:

local connection = Util.addAttributeListener(game.Workspace.NPC, "Health", function(oldValue, newValue)
		print("Health changed from " .. oldValue .. " to " .. newValue)
	end
)

onTouch

Util.onTouch(
partBasePart,
callback(BasePart) → ()
) → RBXScriptConnection

Listens to when a part is touched by another part and runs a callback.

Example:

local connection = Util.onTouch(game.Workspace.NPC, function(part)
	print(part.Name .. " was touched")
end)

onPlayerTouch

Util.onPlayerTouch(
objBasePart,
callback() → (),
ignoreIfDeadboolean?,
offsetPartboolean?
) → RBXScriptConnection

Similar to onTouch, but will only run the callback if the part is touched by a player that is alive.

Example:

local connection = Util.onPlayerTouch(game.Workspace.NPC, function(player, part)
	print(player.Name .. " touched " .. part.Name)
end)

safeSet

Util.safeSet(
objectInstance | {[any]any},
keyany,
valueany
) → boolean--

Whether the operation was successful

Safely sets a key in an Instance or table without erroring.

Returns a boolean indicating if the operation was successful.

Example:

Util.safeSet(Workspace.Player1.Humanoid, "Health", 100)

flip

Util.flip(
source{[any]any},--

The table you want to flip

mergeDuplicatesboolean?--

Merge key duplicates into a table instead of overwriting them.

) → {[any]any}

Flips the table's keys with its values. If mergeDuplicates is true, All values will be stored in a table at the key's index, instead of overwriting them.

Example:

Util.flip({ a = 1, b = 2 }) -- { [1] = "a", [2] = "b" }
Util.flip({ a = 1, b = 2 }, true) -- { [1] = { "a" }, [2] = { "b" } }

-- Use case: finding all keys with the same value
local newTable = Util.flip({ a = 1, b = 2, c = 2 }, true) -- { [1] = { "a" }, [2] = { "b", "c" } }
print(#newTable[2]) -- 2

map

Util.map(
source{[any]any},--

The table you want to map

callbackFn(
any,
any,
any
) → (
any,
any
)--

The function to map the table with

) → {[any]any}

Maps a table or instance to a new table.

Example:

Util.map({ 1, 2, 3 }, function(v)
	return v * 2
end) -- { 2, 4, 6 }

Util.map({ 1, 2, 3 }, function(v, i)
	return i * 2
end) -- { 2, 4, 6 }

filter

Util.filter(
source{[any]any},--

The table you want to filter

callbackFn(
any,
any,
any
) → (boolean?)--

The function to filter the table with (element, index, source)

) → {[any]any}

Filter a table or instance to a new table.

Example:

local noTwo = Util.filter({ 1, 2, 3 }, function(value)
	return value ~= 2
end) -- { 1, 3 }

local parts = Util.filter(Workspace, function(value)
	return value:IsA("Part")
end) -- { Part = Instance, Part2 = Instance }

mapIndex

Util.mapIndex(
source{[any]any},--

The table you want to map

filterFn(
keyany,
valueany,
sourceany
) → (
valueany,
keyany
)--

The function to filter the table with

) → {[any]any}

Maps a table to a new table using the index as the key.

Includes a second argument as a function to filter the table with.

Example:

Util.mapIndex({ 1, 2, 3 }) -- { [1] = 1, [2] = 2, [3] = 3 }

Util.mapIndex({ 1, 2, 3 }, function(v)
	return v * 2
end) -- { [1] = 2, [2] = 4, [3] = 6 }

Util.mapIndex({ 1, 2, 3 }, function(v, i)
	return i * 2
end) -- { [2] = 2, [4] = 4, [6] = 6 }

trimWhitespace

Util.trimWhitespace(textstring) → string

Trims leading and trailing whitespace from a string.

Example:

Util.trimWhitespace("  Hello, world!  ") -- "Hello, world!"

trimLeadingWhitespace

Util.trimLeadingWhitespace(textstring) → string

Trims leading whitespace from a string.

Example:

Util.trimLeadingWhitespace("  Hello, world!") -- "Hello, world!"

trimTrailingWhitespace

Util.trimTrailingWhitespace(textstring) → string

Trims trailing whitespace from a string.

Example:

Util.trimTrailingWhitespace("Hello, world!  ") -- "Hello, world!"

split

Util.split(
textstring | number?,
delimiterstring?,
trimTrailingDelimiterboolean?,
trimboolean?--

Trim whitespace from each chunk

) → {string}

Splits a string into a table of strings using a delimiter. If delimiter is not provided, it defaults to a space.

Setting trimTrailingDelimiter to false will result in an empty string at the end of the table if the text ends with the delimiter

Setting trim to false will result in whitespace not being trimmed from each chunk

Example:

Util.split("Hello, world!") -- { "Hello,", "world!" }
Util.split("Hello, world!", ", ") -- { "Hello", "world!" }
Util.split("Hello, world!", ",", nil, false) -- { "Hello", " world!" } -- no whitespace is trimmed
Util.split("Hello, world!,", ",", false) -- { "Hello", "world!", "" } -- trailing delimiter is included

Util.split("path/to/file", "/") -- { "path", "to", "file" }
Util.split("path/to/file/", "/") -- { "path", "to", "file" } -- trailing delimiter is trimmed

join

Util.join(
stringTable{[any]string | number},--

The table you want to join

separatorstring?--

The separator to use when joining the table (defaults to ",")

) → string

Joins a table of strings and numbers into a single string.

The string is joined using a separator, which defaults to a comma.

Example:

Util.join({"Hello", "world!"}) -- "Hello,world!"
Util.join({"Hello", "world!"}, ", ") -- "Hello, world!"

extend

Util.extend(
targetTable{[any]any},--

The target table you want to extend

...{[any]any}?--

The tables you want to merge into the target table

) → {[any]any}

Extends a table with one or more tables.

Example:

Util.extend({ a = 1 }, { b = 2 }, { c = 3 }) -- { a = 1, b = 2, c = 3 }
Util.extend({ a = 1 }, { a = 2 }, { a = 3 }) -- { a = 3 } -- Last argument overwrites previous arguments
Util.extend({ a = 1 }, { a = 2 }, { a = 3 }, true) -- Error: 4th argument must be a table

Config override example:

local function getDefaultConfig()
	return {
		health = 100
	}
end

local buffConfig = {
	health = 150,
	speed = 1.5
}

local hasBuff: boolean = true
local playerConfig: { [any]: any } = Util.extend(getDefaultConfig(), hasBuff and buffConfig) -- { health = 150, speed = 1.5 }

deepMerge

Util.deepMerge(
targetTable{[any]any},--

The target table you want to merge into

...{[any]any}--

The tables you want to merge into the target table

) → {[any]any}

Recursively merges two or more tables into one.

Example:

Util.deepMerge({ a = { b = { c = 1 } } }, { a = { b = { d = 2 } } }) -- { a = { b = { c = 1, d = 2 } } }

assign

Util.assign(
targetTable{[any]any},--

The target table you want to assign values to

...{[any]any}--

The tables you want to merge into the target table

) → {[any]any}

The assign function copies all properties from one or more source objects to a target object.

Alias for Util.extend.

treePath

Util.treePath(
tree{[any]any} | Instance,--

The table or instance you want to get the value from

pathstring?,--

The path to the value

delimiterstring?--

The delimiter to use when splitting the path

) → any

Gets a value from a table or Instance using a path.

Example:

Util.treePath({ a = { b = { c = 1 } } }, "a.b.c") -- 1
Util.treePath({ a = { b = { c = 1 } } }, "a.b") -- { c = 1 }
Util.treePath(game.Workspace, "House.Door") -- Door instance
Util.treePath(script, "NonexistantChild") -- nil

insertIf

Util.insertIf(
target{[any]any},--

The table you want to insert the value into

valueany,--

The value you want to insert

conditionnil | boolean | () → boolean?--

The test condition

) → ()

Inserts a value into a table if the test condition is true.

Example:

Util.insertIf({ 1, 2, 3 }, 4, true) -- { 1, 2, 3, 4 }
Util.insertIf({ 1, 2, 3 }, 4, false) -- { 1, 2, 3 }
Util.insertIf({ 1, 2, 3 }, 4, function()
	return true
end) -- { 1, 2, 3, 4 }

instanceChildrenToTable

Util.instanceChildrenToTable(
instanceInstance--

The instance you want to collect children from

) → {[string]Instance}

Collects all children of an instance into a table.

Example:

Util.instanceChildrenToTable(game.Workspace) -- { Part = Instance, Part2 = Instance }
Util.instanceChildrenToTable(game.ReplicatedStorage.Config) -- { Config1 = CFrameValue, Config2 = StringValue }

tableLength

Util.tableLength(source{[any]any}) → number

Returns the total amount of values in a table.

Example:

Util.tableLength({ 1, 2, 3 }) -- 3
Util.tableLength({ a = 1, b = 2, c = 3 }) -- 3

tableRandomIndex

Util.tableRandomIndex(
obj{[any]any} | Instance--

The table or instance you want to get a random index from

) → any

Returns a random index from a table or instance.

Example:

Util.tableRandomIndex({ 1, 2, 3 }) -- 2
Util.tableRandomIndex({ a = 1, b = 2, c = 3 }) -- "b"

indexOf

Util.indexOf(
obj{[any]any},--

The table you want to get the index from

valueany--

The value you want to find the index of

) → any

Returns the index of a value in a table. This works for both dictionaries and arrays.

Example:

Util.indexOf({ 1, 2, 3 }, 2) -- 2
Util.indexOf({ a = 1, b = 2, c = 3 }, 2) -- "b"

Use table.find for a more efficient way to find the index of a value in an array.

table.find({ 1, 2, 3 }, 2) -- 2

makeConfigFromValues

Util.makeConfigFromValues(
folderFolder | Configuration--

The folder or Configuration you want to make a table from

) → {[string]any}

Creates a nested table of value instances from a Folder or Configuration instance.

Example:

  • Config (Folder) -- in ReplicatedStorage
    • Origin (CFrameValue), Value = CFrame.new(0, 1, 0)
    • WelcomeMessage (StringValue), Value = "Hello, world!"
Util.makeConfigFromValues(game.ReplicatedStorage.Config)

Result:

{
	Origin = CFrame.new(0, 1, 0),
	WelcomeMessage = "Hello, world!"
}

tableRemove

Util.tableRemove(
obj{[any]any} | Instance,--

The table or instance you want to remove the value from

removeTestnumber | {any} | (
any,
number,
number
) → boolean--

The value to remove or reducing function to use

) → ()

Removes a value from a table or instance.

Example:

Util.tableRemove({ 1, 2, 3 }, 2) -- { 1, 3 }
Util.tableRemove({ 1, 2, 3 }, { 2, 3 }) -- { 1 }
Util.tableRemove({ 1, 2, 3 }, function(value, newIndex, i)
	return value == 2
end) -- { 1, 3 }

waterfall

Util.waterfall(
tasks{(...any) → ...any},--

The tasks to execute

finalCallback(
errany,
...any
) → ()--

The final callback to execute

) → ()

Executes a series of tasks in a waterfall fashion.

Example:

Util.waterfall(
	function(a, b, callback)
		print("Task 1:", a, b)
		callback(nil, "Task 1 result")
	end,
	function(result, callback)
		print("Task 2:", result)
		callback(nil, "Task 2 result")
	end,
	function(result, callback)
		print("Task 3:", result)
		callback(nil, "Task 3 result")
	end,
	function(err, result)
		if err then
			print("Error:", err)
		else
			print("Final result:", result)
		end
	end
)

generateUUID

Util.generateUUID() → string

Generates a UUID/GUID (Universally Unique Identifier) random string using HttpService:GenerateGUID.

timeout

Util.timeout(
delaynumber,
callbackfunction
) → ()

Alternative for task.delay.

Runs a function after delay seconds. Returns the time elapsed in seconds.

Example:

Util.timeout(1, function(elapsedTime: number)
	print("Hello, world!")
end)

interval

Util.interval(
intervalnumber,
callbackfunction
) → RBXScriptConnection

Runs a function every interval in seconds. Return false within the callback to stop the interval or call :Disconnect() on the returned RBXScriptConnection.

This function returns an RBXScriptConnection that can be disconnected to stop the interval.

Example:

Util.interval(1, function(elapsedTime: number, deltaTime: number)
	print(elapsedTime)
end)

inTable

Util.inTable(
searchTable{[any]any},
targetany
) → boolean

Checks if a value is in a table.

Example:

Util.inTable({ 1, 2, 3 }, 2) -- true
Util.inTable({ 1, 2, 3 }, 4) -- false
Util.inTable({ Part, 2, 3, Part2 = true }, Part) -- true
Show raw api
{
    "functions": [
        {
            "name": "getPartCount",
            "desc": "Gets the number of parts in the given instance\n\nExample:\n```lua\nUtil.getPartCount(game.Workspace.NPC) -- 5\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 17,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "getDescendantParts",
            "desc": "Gets all parts in the given instance\n\nExample:\n```lua\nUtil.getDescendantParts(game.Workspace.LightPost) -- { [1] = Light, [2] = PostMeshPart }\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ BasePart }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 51,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "getAncestor",
            "desc": "Gets the first descendant of the given instance that matches the given condition.\nThis will search all descendants of the given instance, including the instance itself.\nIt will stop  if no ancestor is found.\n\nExample 1:\n```lua\ndetector.Touched:Connect(function(part: BasePart)\n\tlocal humanoid = Util.getAncestor(part, \"Humanoid\")\n\n\tif humanoid ~= nil then\n\t\tprint(\"Humanoid touched the detector\")\n\tend\nend)\n```\n\nExample 2:\n```lua\ndetector.Touched:Connect(function(part: BasePart)\n\tlocal bot: Model? = Util.getAncestor(part, function(instance: Instance)\n\t\treturn instance:HasTag(\"NPC\")\n\tend)\n\n\tif bot ~= nil then\n\t\tbot.\n\t\tprint(\"NPC bot touched the detector\")\n\tend\nend)\n```",
            "params": [
                {
                    "name": "child",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "condition",
                    "desc": "",
                    "lua_type": "string | (obj: Instance) -> boolean"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 103,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "find",
            "desc": "Starts at the given node and searches all children for the first child that matches the given condition.\nThis search will continue until `maxDepth` is reached, a match is found, or no more children are found.\nWhen a match is found, it will return the matching child.\nWhen no match is found, it will return nil.\n\nBy default `maxDepth` is 1. Only the children of the given node will be searched.\n\nFunction condition example:\n```lua\nlocal player: Player? = Util.find(game.Players, function(player: Player)\n\treturn player.Name == \"Player1\"\nend)\n```\n\nInstance example:\n```lua\nlocal player: Player? = Util.find(game.Players, \"Player1\")\n```\n\nFiltering example:\n```lua\nlocal NPCs = {\n\t{ Name = \"NPC1\" },\n\t{ Name = \"NPC1\" },\n\t{ Name = \"NPC1\" },\n}\n\nlocal player = Util.find(NPCs, function(NPC)\n\treturn NPC.Name == \"NPC1\"\nend)\n```\n\nAdvanced example:\n```lua\nlocal NPCs = {\n\t{ Name = \"NPC1\", Health = 0 },\n\t{ Name = \"NPC1\", Health = 20 },\n\t{ Name = \"NPC1\", Health = 0 },\n}\n\nlocal firstAliveNPC = Util.find(NPCs, function(NPC)\n\treturn NPC.Health > 0\nend)\n```",
            "params": [
                {
                    "name": "node",
                    "desc": "",
                    "lua_type": "Instance | { [any]: any }"
                },
                {
                    "name": "condition",
                    "desc": "",
                    "lua_type": "string | (obj: Instance) -> boolean"
                },
                {
                    "name": "maxDepth",
                    "desc": "Default: 1",
                    "lua_type": "number"
                },
                {
                    "name": "_depth",
                    "desc": "Internal use, used to track the current depth",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 192,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "exists",
            "desc": "Checks if the given instance has the children with the given key names.\nA single child name can be passed as a string, or multiple child names can be passed as a table.\n\nTable of children example:\n```lua\nUtil.exists(\n\tgame.Workspace.Player1,\n\t{ \"Head\", \"Torso\", \"Left Arm\", \"Right Arm\", \"Left Leg\", \"Right Leg\" }\n) -- true\n```\n\nString child example:\n```lua\nUtil.exists(game.Workspace.Player1, \"Head\") -- true\n```\n\nTable of children in a table node example:\n```lua\nUtil.exists(\n\tgame.Workspace.Player1:GetChildren(), -- table\n\t{ \"Head\", \"Torso\" }\n) -- true\n```\n\nTable node and string child example:\n```lua\nUtil.exists(\n\tgame.Workspace.Player1:GetChildren(), -- table\n\t\"HumanoidRootPart\"\n) -- true\n```",
            "params": [
                {
                    "name": "node",
                    "desc": "",
                    "lua_type": "Instance | { [string]: any }"
                },
                {
                    "name": "children",
                    "desc": "",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 305,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "getFirstPart",
            "desc": "Returns the first part in the given instance\n\nExample:\n```lua\nUtil.getFirstPart(game.Workspace.Player1) -- Head\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "BasePart?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 364,
                "path": "src/Util/SearchUtil.luau"
            }
        },
        {
            "name": "round",
            "desc": "Rounds a number to the nearest integer.\n\n#### Example:\n```lua\nUtil.round(1.5) -- 2\nUtil.round(1.4) -- 1\n```",
            "params": [
                {
                    "name": "_number",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "formatNumber",
            "desc": "Formats a number to have commas.\n\n#### Example:\n```lua\nUtil.formatNumber(1000) -- 1,000\nUtil.formatNumber(1000.01) -- 1,000.01\n```",
            "params": [
                {
                    "name": "number",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "decimals",
                    "desc": "The number of decimal places to round to. Defaults to 2.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 40,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "random",
            "desc": "Returns a random number between two numbers.\n\n#### Example:\n```lua\nUtil.random(1, 10) -- 5\nUtil.random(1, 10, true) -- 5.5\nUtil.random(10) -- 5 (min defaults to 1)\nUtil.random(10, true) -- 5.5 (min defaults to 1)\n```",
            "params": [
                {
                    "name": "minValue",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxValue",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "float",
                    "desc": "Whether to return as a float or not. Defaults to false.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 90,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "randomString",
            "desc": "Returns a random string.\n\n#### Example:\n```lua\nUtil.randomString() -- \"aBcDeFgHiJkLmNoPqRsTuVwXyZ\"\nUtil.randomString(10) -- \"aBcDeFgHiJ\"\n```",
            "params": [
                {
                    "name": "length",
                    "desc": "Length of the string (defaults to 18)",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 124,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "randomObj",
            "desc": "Returns a random object from a table or instance.\n\n#### Example:\n```lua\nUtil.randomObj({ \"a\", \"b\", \"c\" }) -- \"b\"\nUtil.randomObj(Workspace.Player) -- Head\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "table | Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 157,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "coinFlip",
            "desc": "Returns a random boolean.\n\n#### Example:\n```lua\nUtil.coinFlip() -- true\nUtil.coinFlip() -- false\n```",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 187,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "shortenNumber",
            "desc": "Shortens a large number to a readable format.\nUseful for displaying large numbers that don't require exact precision.\nCommon use cases are for displaying XP, money in leaderboards, damage etc.\n\n#### Example:\n```lua\nUtil.shortenNumber(1000) -- 1K\nUtil.shortenNumber(1000000) -- 1M\nUtil.shortenNumber(1000000000) -- 1B\nUtil.shortenNumber(1000000000000) -- 1T\nUtil.shortenNumber(1000000000000000) -- 1Q\n```\n\nminimumTiers is useful for when you want to shorten a number but only if it's above a certain tier.\nFor example, if you want to shorten a number but only if it's above 1,000,000, you would do:\n```lua\nUtil.shortenNumber(1000000, 2) -- 1,000,000\n```\n\nA tier is the amount of commas in a number. For example, 1,000,000 has 2 tiers and 1,000 has 1 tier.\n\nTier list and their abbreviations:\n- 1,000 = K\n- 1,000,000 = M\n- 1,000,000,000 = B\n- 1,000,000,000,000 = T\n- 1,000,000,000,000,000 = Q",
            "params": [
                {
                    "name": "number",
                    "desc": "",
                    "lua_type": "number | string"
                },
                {
                    "name": "minimumTiers",
                    "desc": "The minimum number of tiers to shorten. Defaults to 1.",
                    "lua_type": "number?"
                },
                {
                    "name": "decimals",
                    "desc": "The number of decimal places to round to. Defaults to 1.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 229,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "getVector3",
            "desc": "Gets a Vector3 from an object containing a Vector3 or CFrame.\n\n#### Supports:\n- Vector3\n- CFrame\n- Attachment\n- BasePart\n- CFrameValue\n- Vector3Value\n- Camera",
            "params": [
                {
                    "name": "object",
                    "desc": "",
                    "lua_type": "Vector3 | CFrame | Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Vector3?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 316,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "getDistance",
            "desc": "Gets the distance between two Vector3s.",
            "params": [
                {
                    "name": "origin",
                    "desc": "",
                    "lua_type": "Vector3 | Instance"
                },
                {
                    "name": "target",
                    "desc": "",
                    "lua_type": "Vector3 | Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 337,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "getPartBottomSurface",
            "desc": "Gets the bottom surface of a part.",
            "params": [
                {
                    "name": "part",
                    "desc": "",
                    "lua_type": "BasePart"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "CFrame"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 360,
                "path": "src/Util/MathUtil.luau"
            }
        },
        {
            "name": "getGroupRank",
            "desc": "Gets the group rank of a player.\n\n#### Example:\n```lua\nUtil.getGroupRank(game.Players.LocalPlayer, 1) -- 255\n```",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "groupId",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 21,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "isCreator",
            "desc": "Checks if a player is the creator of the game.\n\n#### Example:\n```lua\nUtil.isCreator(game.Players.LocalPlayer) -- true\n```",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 60,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "getUserLevel",
            "desc": "Gets the user level of a player.\n\n#### Example:\n```lua\nUtil.getUserLevel(game.Players.LocalPlayer) -- 0\nUtil.getUserLevel(game.Players.GameDeveloper) -- 4\nUtil.getUserLevel(game.Players.PremiumPlayer) -- 4\nUtil.getUserLevel(game.Players.Creator) -- 5\n```",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 96,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "getHumanoid",
            "desc": "Gets the humanoid object from a player's character part, character model, player object, or humanoid.\n\n#### Example:\n```lua\nUtil.getHumanoid(game.Players.LocalPlayer) -- Humanoid\n```",
            "params": [
                {
                    "name": "object",
                    "desc": "",
                    "lua_type": "Instance?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Humanoid?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 131,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "isAlive",
            "desc": "Checks if a humanoid is alive.\nIf no humanoid is found, it will return nil\n\n#### Example:\n```lua\nUtil.isAlive(game.Players.LocalPlayer) -- true\nUtil.isAlive(game.Workspace.Zombie) -- false\nUtil.isAlive(game.Workspace.Part) -- nil, but will throw a warning\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "Instance?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 164,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "hasHumanoid",
            "desc": "Checks if an object has a humanoid.\n\n#### Example:\n```lua\nUtil.hasHumanoid(game.Players.LocalPlayer) -- true\nUtil.hasHumanoid(game.Workspace.Zombie) -- true\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "Instance?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 187,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "getCharacterFromInstance",
            "desc": "Gets the character model from a BasePart.\n\nUseful for getting the character model from a Touched event or a raycast.\n\n#### Example:\n```lua\nlocal rig: Model? = Util.getCharacterFromInstance(hit.Part)\nlocal rigPlayer: Player? = Players:GetPlayerFromCharacter(rig)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Model?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 206,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "getPlayerFromInstance",
            "desc": "Gets the player object from a BasePart.\n\n#### Example:\n```lua\nUtil.getPlayerFromInstance(game.Workspace.Part) -- Player\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Player?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 234,
                "path": "src/Util/PlayerUtil.luau"
            }
        },
        {
            "name": "dateTimeComponentsToTimestamp",
            "desc": "Converts a DateTimeComponents table to a timestamp.",
            "params": [
                {
                    "name": "components",
                    "desc": "",
                    "lua_type": "DateTimeComponents"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 42,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "unix",
            "desc": "Get the current unix timestamp in UTC time.\nThis is the number of **seconds** since January 1, 1970.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 75,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "timeAgoUnix",
            "desc": "Gets the time in seconds since now or the provided timestamp.",
            "params": [
                {
                    "name": "timestamp",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "endTimestamp",
                    "desc": "The timestamp to compare to. Defaults to current time.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 89,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "formatUnix",
            "desc": "Converts a unix timestamp to a `mm:ss` format (e.g. 00:02).\nA format and locale can be provided.\n\nUse the [DateTime](https://create.roblox.com/docs/reference/engine/datatypes/DateTime) API for formatting options.\n\n#### Example\n```lua\nlocal secondsLeft: number = 80\n\nUtil.formatUnix(secondsLeft, \"mm:ss\", nil, true) -- 01:20\nUtil.formatUnix(secondsLeft, \"HH:mm:ss\", nil, true) -- 00:01:20\n```",
            "params": [
                {
                    "name": "timestamp",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "format",
                    "desc": "The format to use.",
                    "lua_type": "string"
                },
                {
                    "name": "locale",
                    "desc": "The locale to use. Defaults to `en-us`.",
                    "lua_type": "string?"
                },
                {
                    "name": "useUTC",
                    "desc": "Whether to use UTC time. Defaults to local time.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "The formatted time in local time.",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 120,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "elapsedTimeClockFormat",
            "desc": "Converts a unix timestamp to a `mm:ss` format (e.g. 00:02).\n\n#### Example\n```lua\nUtil.elapsedTimeClockFormat(80) -- 01:20\nUtil.elapsedTimeClockFormat(3661) -- 01:01:01\n```",
            "params": [
                {
                    "name": "timestamp",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "The formatted time in local time.",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 152,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "timeAgo",
            "desc": "Converts a unix timestamp to a readable time ago format (e.g. 1 minute ago, 1 minute 20 seconds ago).\n\n#### Example\n```lua\nlocal secondsLeft: number = 80\n\nUtil.timeAgo(secondsLeft) -- 1 minute ago\n```\n\n```lua\nlocal secondsLeft: number = 80\n\nUtil.timeAgo(secondsLeft, 80 + 60) -- just now\n```",
            "params": [
                {
                    "name": "timestamp",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "endTimestamp",
                    "desc": "The timestamp to compare to. Defaults to current time.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 185,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "totalTime",
            "desc": "Similar to `Util.timeAgo` but returns a more detailed string with the total time instead of the largest unit.\nConvert a unix timestamp to a readable format (1 days, 1 hours, 1 minutes, 1 seconds).\n\n#### Example\n```lua\nlocal secondsLeft: number = 80\n\nUtil.totalTime(secondsLeft) -- 1 minute 20 seconds\n```",
            "params": [
                {
                    "name": "timestamp",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "endTimestamp",
                    "desc": "The timestamp to compare to. Defaults to current time.",
                    "lua_type": "number?"
                },
                {
                    "name": "separator",
                    "desc": "The separator to use between each unit. Defaults to a space.",
                    "lua_type": "string?"
                },
                {
                    "name": "depth",
                    "desc": "The maximum number of units to return.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 244,
                "path": "src/Util/DateUtil.luau"
            }
        },
        {
            "name": "use",
            "desc": "Injects a module into the Util module.\n\nExample:\n```lua\n-- Before\nUtil.requiredFunction() -- error: \"Function not found\"\n\n-- After\nlocal pathToModule: ModuleScript = script.Parent.Module\nUtil.use(pathToModule)\n\nUtil.requiredFunction() -- \"Hello world!\"\n```",
            "params": [
                {
                    "name": "moduleName",
                    "desc": "",
                    "lua_type": "string | ModuleScript"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "printTable",
            "desc": "Prints a JSON string to the console using HttpService.\n\nExample:\n```lua\nUtil.printTable({\n\tfoo = \"bar\";\n\tbar = \"foo\";\n}) -- {\"foo\":\"bar\",\"bar\":\"foo\"}\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 315,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "numberSequence",
            "desc": "Create a new NumberSequence from a table of keypoints.\n\nExample:\n```lua\nlocal gradient: ColorSequence = Util.colorSequence({\n\t{ 0, Color3.fromRGB(255, 0, 0) };\n\t{ 1, Color3.fromRGB(0, 255, 0) };\n})\n\nlocal particle: ParticleEmitter = Instance.new(\"ParticleEmitter\")\nparticle.Color = gradient\n```",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "{ any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "NumberSequence"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 339,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "getProductInfo",
            "desc": "Retrieves product info with the Roblox marketplace API.",
            "params": [
                {
                    "name": "productId",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "infoType",
                    "desc": "",
                    "lua_type": "Enum.InfoType?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 367,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "getAssetURI",
            "desc": "Returns an asset URI.\n\nExample:\n```lua\nUtil.getAssetURI(\"rbxassetid://1234567890\") -- rbxassetid://1234567890\nUtil.getAssetURI(1234567890) -- rbxassetid://1234567890\n\n-- Fallback URIs\nUtil.getAssetURI(nil, \"rbxassetid://1234567890\") -- rbxassetid://1234567890 (fallback)\nUtil.getAssetURI(nil, 1234567890) -- rbxassetid://1234567890 (fallback)\n```",
            "params": [
                {
                    "name": "assetId",
                    "desc": "",
                    "lua_type": "(number | string)?"
                },
                {
                    "name": "fallbackAssetId",
                    "desc": "",
                    "lua_type": "(number | string)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 416,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "attempt",
            "desc": "Calls the given function until it successfully runs.\nUseful for retrieving from a data store or GET/POST requests.\n\nIt will return a tuple of (success: boolean, result: any, tries: number).\n\nExample:\n```lua\nlocal success: boolean, result: any, tries: number = Util.attempt(function()\n\treturn game:GetService(\"HttpService\"):GetAsync(\"https://example.com\")\nend)\n\nprint(success, result)\nprint(`It took {tries} tries to retrieve the data`)\n```",
            "params": [
                {
                    "name": "runner",
                    "desc": "",
                    "lua_type": "() -> ()"
                },
                {
                    "name": "maxTries",
                    "desc": "Defaults to 3",
                    "lua_type": "number?"
                },
                {
                    "name": "yield",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "(boolean, any, number)"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 466,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "try",
            "desc": "Simple try catch function.\n\nExample:\n```lua\nlocal result: any = Util.try(function()\n\treturn \"Hello world!\"\nend, function(err)\n\twarn(\"Error: \" .. err)\nend)\n\nprint(result) -- \"Hello world!\"\n```\n\nExample:\n```lua\nlocal result: any = Util.try(function()\n\terror(\"Something went wrong\")\nend, function(err)\n\twarn(\"Error: \" .. err)\nend)\n\nprint(result) -- nil\n```",
            "params": [
                {
                    "name": "runner",
                    "desc": "",
                    "lua_type": "() -> ()"
                },
                {
                    "name": "catch",
                    "desc": "",
                    "lua_type": "(any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 533,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "weld",
            "desc": "Welds 2 parts together.\n\nExample:\n```lua\nlocal weld: WeldConstraint = Util.weld(game.Workspace.Car.Wheel, game.Workspace.Car)\n```",
            "params": [
                {
                    "name": "part",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "attachTo",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "offset",
                    "desc": "",
                    "lua_type": "CFrame?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "WeldConstraint"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 562,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "weldModel",
            "desc": "Welds all parts in a model to the PrimaryPart if it is set.\n\nExample:\n```lua\nUtil.weldModel(game.Workspace.Car)\n```",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Model?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 599,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "clearWelds",
            "desc": "Clears all welds from an instance.\n\nExample:\n```lua\nUtil.clearWelds(game.Workspace.House)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 629,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "breakJoints",
            "desc": "Clears all joints from an instance.\n\nExample:\n```lua\nUtil.breakJoints(game.Workspace.House)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 653,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "getMass",
            "desc": "Gets the mass of a model.",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 675,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "waitForChild",
            "desc": "Wait for a child to be added to an instance. WARNING: This function will forever wait until the child is added.",
            "params": [
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 741,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "waitForPrimaryPart",
            "desc": "Wait for the primary part of a model to be set.",
            "params": [
                {
                    "name": "model",
                    "desc": "",
                    "lua_type": "Model"
                },
                {
                    "name": "timeout",
                    "desc": "Defaults to 15 seconds",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "BasePart?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 774,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "addListener",
            "desc": "Expiremental\n\nListens to a property or attribute on an instance and runs a callback when it changes.\nIt will return a connection that can be disconnected.\n\nUsing addListener() is an addition to Roblox's built-in GetPropertyChangedSignal() and GetAttributeChangedSignal().\n\nThe callback will be called with the previous value and the new value.\n\nExample:\n```lua\nlocal connection = Util.addListener(\n\tgame.Workspace.NPC,\n\t\"Health\",\n\t\"Attribute\",\n\tfunction(oldValue, newValue)\n\t\tprint(\"Health changed from \" .. oldValue .. \" to \" .. newValue)\n\tend\n)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "listenerType",
                    "desc": "\"Property\" | \"Attribute\"",
                    "lua_type": "string"
                },
                {
                    "name": "listenTo",
                    "desc": "The property or attribute to listen to",
                    "lua_type": "string"
                },
                {
                    "name": "callback",
                    "desc": "The callback to run when the property or attribute changes",
                    "lua_type": "(any, any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 824,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "addPropertyListener",
            "desc": "Shortcut for Util.addListener\n\nExample:\n```lua\nlocal connection = Util.addPropertyListener(game.Workspace.NPC, \"Name\", function(oldValue, newValue)\n\t\tprint(\"Name changed from \" .. oldValue .. \" to \" .. newValue)\n\tend\n)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "listenTo",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(any, any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 876,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "addAttributeListener",
            "desc": "Shortcut for Util.addListener\n\nExample:\n```lua\nlocal connection = Util.addAttributeListener(game.Workspace.NPC, \"Health\", function(oldValue, newValue)\n\t\tprint(\"Health changed from \" .. oldValue .. \" to \" .. newValue)\n\tend\n)\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "listenTo",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(any, any) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 911,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "onTouch",
            "desc": "Listens to when a part is touched by another part and runs a callback.\n\nExample:\n```lua\nlocal connection = Util.onTouch(game.Workspace.NPC, function(part)\n\tprint(part.Name .. \" was touched\")\nend)\n```",
            "params": [
                {
                    "name": "part",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(BasePart) -> ()"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 950,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "onPlayerTouch",
            "desc": "Similar to onTouch, but will only run the callback if the part is touched by a player that is alive.\n\nExample:\n```lua\nlocal connection = Util.onPlayerTouch(game.Workspace.NPC, function(player, part)\n\tprint(player.Name .. \" touched \" .. part.Name)\nend)\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "BasePart"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "(Player, BasePart) -> ()"
                },
                {
                    "name": "ignoreIfDead",
                    "desc": "",
                    "lua_type": "boolean?"
                },
                {
                    "name": "offsetPart",
                    "desc": "",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 985,
                "path": "src/Util/init.luau"
            }
        },
        {
            "name": "safeSet",
            "desc": "Safely sets a key in an Instance or table without erroring.\n\nReturns a boolean indicating if the operation was successful.\n\n#### Example:\n```lua\nUtil.safeSet(Workspace.Player1.Humanoid, \"Health\", 100)\n```",
            "params": [
                {
                    "name": "object",
                    "desc": "",
                    "lua_type": "Instance | { [any]: any }"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the operation was successful",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 32,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "flip",
            "desc": "Flips the table's keys with its values.\nIf `mergeDuplicates` is `true`, All values will be stored in a table at the key's index, instead of overwriting them.\n\n#### Example:\n```lua\nUtil.flip({ a = 1, b = 2 }) -- { [1] = \"a\", [2] = \"b\" }\nUtil.flip({ a = 1, b = 2 }, true) -- { [1] = { \"a\" }, [2] = { \"b\" } }\n\n-- Use case: finding all keys with the same value\nlocal newTable = Util.flip({ a = 1, b = 2, c = 2 }, true) -- { [1] = { \"a\" }, [2] = { \"b\", \"c\" } }\nprint(#newTable[2]) -- 2\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "The table you want to flip",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "mergeDuplicates",
                    "desc": "Merge key duplicates into a table instead of overwriting them.",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 66,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "map",
            "desc": "Maps a table or instance to a new table.\n\n#### Example:\n```lua\nUtil.map({ 1, 2, 3 }, function(v)\n\treturn v * 2\nend) -- { 2, 4, 6 }\n\nUtil.map({ 1, 2, 3 }, function(v, i)\n\treturn i * 2\nend) -- { 2, 4, 6 }\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "The table you want to map",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "callbackFn",
                    "desc": "The function to map the table with",
                    "lua_type": "(any, any, any) -> (any, any)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 111,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "filter",
            "desc": "Filter a table or instance to a new table.\n\n#### Example:\n```lua\nlocal noTwo = Util.filter({ 1, 2, 3 }, function(value)\n\treturn value ~= 2\nend) -- { 1, 3 }\n\nlocal parts = Util.filter(Workspace, function(value)\n\treturn value:IsA(\"Part\")\nend) -- { Part = Instance, Part2 = Instance }\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "The table you want to filter",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "callbackFn",
                    "desc": "The function to filter the table with (element, index, source)",
                    "lua_type": "(any, any, any) -> (boolean?)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 170,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "mapIndex",
            "desc": "Maps a table to a new table using the index as the key.\n\nIncludes a second argument as a function to filter the table with.\n\n#### Example:\n```lua\nUtil.mapIndex({ 1, 2, 3 }) -- { [1] = 1, [2] = 2, [3] = 3 }\n\nUtil.mapIndex({ 1, 2, 3 }, function(v)\n\treturn v * 2\nend) -- { [1] = 2, [2] = 4, [3] = 6 }\n\nUtil.mapIndex({ 1, 2, 3 }, function(v, i)\n\treturn i * 2\nend) -- { [2] = 2, [4] = 4, [6] = 6 }\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "The table you want to map",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "filterFn",
                    "desc": "The function to filter the table with",
                    "lua_type": "(key: any, value: any, source: any) -> (value: any, key: any)"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 224,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "trimWhitespace",
            "desc": "Trims leading and trailing whitespace from a string.\n\n#### Example:\n```lua\nUtil.trimWhitespace(\"  Hello, world!  \") -- \"Hello, world!\"\n```",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 269,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "trimLeadingWhitespace",
            "desc": "Trims leading whitespace from a string.\n\n#### Example:\n```lua\nUtil.trimLeadingWhitespace(\"  Hello, world!\") -- \"Hello, world!\"\n```",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 287,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "trimTrailingWhitespace",
            "desc": "Trims trailing whitespace from a string.\n\n#### Example:\n```lua\nUtil.trimTrailingWhitespace(\"Hello, world!  \") -- \"Hello, world!\"\n```",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 305,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "split",
            "desc": "Splits a string into a table of strings using a delimiter.\nIf `delimiter` is not provided, it defaults to a space.\n\nSetting `trimTrailingDelimiter` to `false` will result in an empty string at the end of the table if the text ends with the delimiter\n\nSetting `trim` to `false` will result in whitespace not being trimmed from each chunk\n\n#### Example:\n```lua\nUtil.split(\"Hello, world!\") -- { \"Hello,\", \"world!\" }\nUtil.split(\"Hello, world!\", \", \") -- { \"Hello\", \"world!\" }\nUtil.split(\"Hello, world!\", \",\", nil, false) -- { \"Hello\", \" world!\" } -- no whitespace is trimmed\nUtil.split(\"Hello, world!,\", \",\", false) -- { \"Hello\", \"world!\", \"\" } -- trailing delimiter is included\n\nUtil.split(\"path/to/file\", \"/\") -- { \"path\", \"to\", \"file\" }\nUtil.split(\"path/to/file/\", \"/\") -- { \"path\", \"to\", \"file\" } -- trailing delimiter is trimmed\n```",
            "params": [
                {
                    "name": "text",
                    "desc": "",
                    "lua_type": "string | number?"
                },
                {
                    "name": "delimiter",
                    "desc": "",
                    "lua_type": "string?"
                },
                {
                    "name": "trimTrailingDelimiter",
                    "desc": "",
                    "lua_type": "boolean?"
                },
                {
                    "name": "trim",
                    "desc": "Trim whitespace from each chunk",
                    "lua_type": "boolean?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 337,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "join",
            "desc": "Joins a table of strings and numbers into a single string.\n\nThe string is joined using a separator, which defaults to a comma.\n\n#### Example:\n```lua\nUtil.join({\"Hello\", \"world!\"}) -- \"Hello,world!\"\nUtil.join({\"Hello\", \"world!\"}, \", \") -- \"Hello, world!\"\n```",
            "params": [
                {
                    "name": "stringTable",
                    "desc": "The table you want to join",
                    "lua_type": "{ [any]: string | number }"
                },
                {
                    "name": "separator",
                    "desc": "The separator to use when joining the table (defaults to \",\")",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 429,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "extend",
            "desc": "Extends a table with one or more tables.\n\n#### Example:\n```lua\nUtil.extend({ a = 1 }, { b = 2 }, { c = 3 }) -- { a = 1, b = 2, c = 3 }\nUtil.extend({ a = 1 }, { a = 2 }, { a = 3 }) -- { a = 3 } -- Last argument overwrites previous arguments\nUtil.extend({ a = 1 }, { a = 2 }, { a = 3 }, true) -- Error: 4th argument must be a table\n```\n\n#### Config override example:\n```lua\nlocal function getDefaultConfig()\n\treturn {\n\t\thealth = 100\n\t}\nend\n\nlocal buffConfig = {\n\thealth = 150,\n\tspeed = 1.5\n}\n\nlocal hasBuff: boolean = true\nlocal playerConfig: { [any]: any } = Util.extend(getDefaultConfig(), hasBuff and buffConfig) -- { health = 150, speed = 1.5 }\n```",
            "params": [
                {
                    "name": "targetTable",
                    "desc": "The target table you want to extend",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "...",
                    "desc": "The tables you want to merge into the target table",
                    "lua_type": "{ [any]: any }?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 493,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "deepMerge",
            "desc": "Recursively merges two or more tables into one.\n\n#### Example:\n```lua\nUtil.deepMerge({ a = { b = { c = 1 } } }, { a = { b = { d = 2 } } }) -- { a = { b = { c = 1, d = 2 } } }\n```",
            "params": [
                {
                    "name": "targetTable",
                    "desc": "The target table you want to merge into",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "...",
                    "desc": "The tables you want to merge into the target table",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 521,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "assign",
            "desc": "The assign function copies all properties from one or more source objects to a target object.\n\nAlias for `Util.extend`.",
            "params": [
                {
                    "name": "targetTable",
                    "desc": "The target table you want to assign values to",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "...",
                    "desc": "The tables you want to merge into the target table",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 552,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "treePath",
            "desc": "Gets a value from a table or Instance using a path.\n\n#### Example:\n```lua\nUtil.treePath({ a = { b = { c = 1 } } }, \"a.b.c\") -- 1\nUtil.treePath({ a = { b = { c = 1 } } }, \"a.b\") -- { c = 1 }\nUtil.treePath(game.Workspace, \"House.Door\") -- Door instance\nUtil.treePath(script, \"NonexistantChild\") -- nil\n```",
            "params": [
                {
                    "name": "tree",
                    "desc": "The table or instance you want to get the value from",
                    "lua_type": "{ [any]: any } | Instance"
                },
                {
                    "name": "path",
                    "desc": "The path to the value",
                    "lua_type": "string?"
                },
                {
                    "name": "delimiter",
                    "desc": "The delimiter to use when splitting the path",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 585,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "insertIf",
            "desc": "Inserts a value into a table if the test condition is true.\n\n#### Example:\n```lua\nUtil.insertIf({ 1, 2, 3 }, 4, true) -- { 1, 2, 3, 4 }\nUtil.insertIf({ 1, 2, 3 }, 4, false) -- { 1, 2, 3 }\nUtil.insertIf({ 1, 2, 3 }, 4, function()\n\treturn true\nend) -- { 1, 2, 3, 4 }\n```",
            "params": [
                {
                    "name": "target",
                    "desc": "The table you want to insert the value into",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "value",
                    "desc": "The value you want to insert",
                    "lua_type": "any"
                },
                {
                    "name": "condition",
                    "desc": "The test condition",
                    "lua_type": "nil | boolean | () -> boolean?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 645,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "instanceChildrenToTable",
            "desc": "Collects all children of an instance into a table.\n\n#### Example:\n```lua\nUtil.instanceChildrenToTable(game.Workspace) -- { Part = Instance, Part2 = Instance }\nUtil.instanceChildrenToTable(game.ReplicatedStorage.Config) -- { Config1 = CFrameValue, Config2 = StringValue }\n```",
            "params": [
                {
                    "name": "instance",
                    "desc": "The instance you want to collect children from",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: Instance }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 681,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "tableLength",
            "desc": "Returns the total amount of values in a table.\n\n#### Example:\n```lua\nUtil.tableLength({ 1, 2, 3 }) -- 3\nUtil.tableLength({ a = 1, b = 2, c = 3 }) -- 3\n```",
            "params": [
                {
                    "name": "source",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 706,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "tableRandomIndex",
            "desc": "Returns a random index from a table or instance.\n\n#### Example:\n```lua\nUtil.tableRandomIndex({ 1, 2, 3 }) -- 2\nUtil.tableRandomIndex({ a = 1, b = 2, c = 3 }) -- \"b\"\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "The table or instance you want to get a random index from",
                    "lua_type": "{ [any]: any } | Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 731,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "indexOf",
            "desc": "Returns the index of a value in a table.\nThis works for both dictionaries and arrays.\n\n#### Example:\n```lua\nUtil.indexOf({ 1, 2, 3 }, 2) -- 2\nUtil.indexOf({ a = 1, b = 2, c = 3 }, 2) -- \"b\"\n```\n\nUse `table.find` for a more efficient way to find the index of a value in an array.\n```lua\ntable.find({ 1, 2, 3 }, 2) -- 2\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "The table you want to get the index from",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "value",
                    "desc": "The value you want to find the index of",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 771,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "makeConfigFromValues",
            "desc": "Creates a nested table of value instances from a Folder or Configuration instance.\n\n#### Example:\n\n- Config (Folder) -- in ReplicatedStorage\n  - Origin (CFrameValue), Value = CFrame.new(0, 1, 0)\n  - WelcomeMessage (StringValue), Value = \"Hello, world!\"\n\n```lua\nUtil.makeConfigFromValues(game.ReplicatedStorage.Config)\n```\n\nResult:\n```lua\n{\n\tOrigin = CFrame.new(0, 1, 0),\n\tWelcomeMessage = \"Hello, world!\"\n}\n```",
            "params": [
                {
                    "name": "folder",
                    "desc": "The folder or Configuration you want to make a table from",
                    "lua_type": "Folder | Configuration"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: any }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 823,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "tableRemove",
            "desc": "Removes a value from a table or instance.\n\n#### Example:\n```lua\nUtil.tableRemove({ 1, 2, 3 }, 2) -- { 1, 3 }\nUtil.tableRemove({ 1, 2, 3 }, { 2, 3 }) -- { 1 }\nUtil.tableRemove({ 1, 2, 3 }, function(value, newIndex, i)\n\treturn value == 2\nend) -- { 1, 3 }\n```",
            "params": [
                {
                    "name": "obj",
                    "desc": "The table or instance you want to remove the value from",
                    "lua_type": "{ [any]: any } | Instance"
                },
                {
                    "name": "removeTest",
                    "desc": "The value to remove or reducing function to use",
                    "lua_type": "number | { any } | (any, number, number) -> boolean"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 861,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "waterfall",
            "desc": "Executes a series of tasks in a waterfall fashion.\n\n#### Example:\n```lua\nUtil.waterfall(\n\tfunction(a, b, callback)\n\t\tprint(\"Task 1:\", a, b)\n\t\tcallback(nil, \"Task 1 result\")\n\tend,\n\tfunction(result, callback)\n\t\tprint(\"Task 2:\", result)\n\t\tcallback(nil, \"Task 2 result\")\n\tend,\n\tfunction(result, callback)\n\t\tprint(\"Task 3:\", result)\n\t\tcallback(nil, \"Task 3 result\")\n\tend,\n\tfunction(err, result)\n\t\tif err then\n\t\t\tprint(\"Error:\", err)\n\t\telse\n\t\t\tprint(\"Final result:\", result)\n\t\tend\n\tend\n)\n```",
            "params": [
                {
                    "name": "tasks",
                    "desc": "The tasks to execute",
                    "lua_type": "{ (...any) -> ...any }"
                },
                {
                    "name": "finalCallback",
                    "desc": "The final callback to execute",
                    "lua_type": "(err: any, ...any) -> ()"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 931,
                "path": "src/Util/TableUtil.luau"
            }
        },
        {
            "name": "generateUUID",
            "desc": "Generates a UUID/GUID (Universally Unique Identifier) random string using HttpService:GenerateGUID.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 12,
                "path": "src/Util/SystemUtil.luau"
            }
        },
        {
            "name": "timeout",
            "desc": "Alternative for `task.delay`.\n\nRuns a function after `delay` seconds.\nReturns the time elapsed in seconds.\n\n#### Example:\n```lua\nUtil.timeout(1, function(elapsedTime: number)\n\tprint(\"Hello, world!\")\nend)\n```",
            "params": [
                {
                    "name": "delay",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "function"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "src/Util/SystemUtil.luau"
            }
        },
        {
            "name": "interval",
            "desc": "Runs a function every `interval` in seconds.\nReturn `false` within the callback to stop the interval or call `:Disconnect()` on the returned `RBXScriptConnection`.\n\nThis function returns an `RBXScriptConnection` that can be disconnected to stop the interval.\n\n#### Example:\n```lua\nUtil.interval(1, function(elapsedTime: number, deltaTime: number)\n\tprint(elapsedTime)\nend)\n```",
            "params": [
                {
                    "name": "interval",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "callback",
                    "desc": "",
                    "lua_type": "function"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptConnection"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 71,
                "path": "src/Util/SystemUtil.luau"
            }
        },
        {
            "name": "inTable",
            "desc": "Checks if a value is in a table.\n\n#### Example:\n```lua\nUtil.inTable({ 1, 2, 3 }, 2) -- true\nUtil.inTable({ 1, 2, 3 }, 4) -- false\nUtil.inTable({ Part, 2, 3, Part2 = true }, Part) -- true\n```",
            "params": [
                {
                    "name": "searchTable",
                    "desc": "",
                    "lua_type": "{ [any]: any }"
                },
                {
                    "name": "target",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 117,
                "path": "src/Util/SystemUtil.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "userLevel",
            "desc": "",
            "lua_type": "table<number, number>",
            "source": {
                "line": 72,
                "path": "src/Util/PlayerUtil.luau"
            }
        }
    ],
    "types": [
        {
            "name": "ValueBaseType",
            "desc": "This is a custom type to represent and typecheck value instances.\n\nRoblox has a built-in [ValueBase](https://create.roblox.com/docs/reference/engine/classes/ValueBase) type, but it does not have a `Value` property.\n\n#### Example:\n```lua\nlocal value: ValueBaseType = Instance.new(\"BoolValue\")\n```",
            "lua_type": "ValueBase & { Value: any }",
            "source": {
                "line": 237,
                "path": "src/Util/init.luau"
            }
        }
    ],
    "name": "Util",
    "desc": "Install with wally by adding the following to your `wally.toml`:\n```toml\nUtil = \"dig1t/util@1.0.19\"\n```",
    "source": {
        "line": 22,
        "path": "src/Util/init.luau"
    }
}