Skip to main content

Examples

Toolbox provides a collection of simple utilities designed to reduce repetitive code when developing Roblox experiences.

Getting Started​

Require Toolbox in your script:

local Toolbox = require(path.Toolbox)

All utilities are available directly from the Toolbox module.

Finding Instances​

Instead of manually looping through descendants, use the built-in instance utilities:

local button = Toolbox.WaitForDescendantOfClass(screenGui, "TextButton")

button.Text = "Clicked!"

You can also retrieve multiple instances:

local buttons = Toolbox.GetDescendantsOfClass(screenGui, "TextButton")

for _, button in buttons do
print(button.Name)
end

Working With Players​

Get common player objects without repeatedly checking for characters:

local humanoid = Toolbox.GetHumanoid(player)
local root = Toolbox.GetRoot(player)

if humanoid then
print(`Health: {humanoid.Health}`)
end

Check player status:

if Toolbox.IsAlive(player) then
print("Player is alive")
end

String Formatting​

Convert strings into different formats:

local pascal = Toolbox.ToPascalCase("hello world")
local camel = Toolbox.ToCamelCase("hello world")
local snake = Toolbox.ToSnakeCase("hello world")

print(pascal)
-- HelloWorld

print(camel)
-- helloWorld

print(snake)
-- hello_world

Debugging​

Inspect a player:

Toolbox.DumpPlayer(player)

Print an instance hierarchy:

Toolbox.PrintInstanceTree(workspace)

Print a table recursively:

Toolbox.PrintTable({
Score = 100,
Stats = {
Level = 5
}
})

Cleaning Up Instances​

Toolbox.SafeDestroy(part)

Remove all instances of a specific class:

Toolbox.RemoveInstancesOfClass(workspace, "ParticleEmitter")

Toolbox is designed to handle common development patterns while keeping your own game code focused on gameplay logic.

Use Toolbox for repetitive tasks, but keep game-specific behavior inside your own systems and modules.