Forest Logo
search
package_2

commonutils

By @mrkirdid

Roblox

Mirrored

CommonUtils

CommonUtils is a Roblox utility package for common math, table, string, instance, pathfinding, tween, raycast, UI, and state-management work.

It is set up as a normal Wally package and can be required directly from ReplicatedStorage.Packages.CommonUtils after installation.

Install

Add the package to your project's wally.toml:

[dependencies]
CommonUtils = "mrkirdid/commonutils@^0.1.0"

Then install dependencies:

wally install

Require

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Packages = ReplicatedStorage:WaitForChild("Packages")

local CommonUtils = require(Packages:WaitForChild("CommonUtils"))

The package also depends on Wally-managed aliases for Promise, Signal, and Janitor, and re-exports them from the package root for convenience.

Quick Examples

Number formatting

local CommonUtils = require(game.ReplicatedStorage.Packages.CommonUtils)

print(CommonUtils.Format.commas(1234567))
print(CommonUtils.Format.compactNumber(15320))
print(CommonUtils.String.formatThousands(987654321))

Retry work with Task.retry

local CommonUtils = require(game.ReplicatedStorage.Packages.CommonUtils)

local success, value, err = CommonUtils.Task.retry(3, function()
	return workspace:FindFirstChild("SpawnLocation") or error("SpawnLocation missing")
end, 0.1)

if success then
	print("Found", value)
else
	warn(err)
end

Observe tag lifecycle

local CommonUtils = require(game.ReplicatedStorage.Packages.CommonUtils)

local observer = CommonUtils.Collection.observeTag("Enemy", function(model)
	print("spawned", model)
end, function(model)
	print("removed", model)
end)

-- Later:
observer:Disconnect()

Pool and release objects in bulk

local CommonUtils = require(game.ReplicatedStorage.Packages.CommonUtils)

local pool = CommonUtils.ObjectPool.new(function()
	return Instance.new("Part")
end, {
	reset = function(part)
		part.CFrame = CFrame.new()
	end,
})

local partA = pool:acquire()
local partB = pool:acquire()

pool:releaseAll()

Modules

Core data and text

  • Table
  • String
  • Format
  • Enum
  • Debug

Math and geometry

  • Math
  • Vector2
  • Vector3
  • CFrame
  • Color
  • Sequence
  • Curves
  • Bezier
  • Random

Instances and world helpers

  • Instance
  • Raycast
  • Pathfinding
  • Collection

Async and state

  • Task
  • Timer
  • Tween
  • Spring
  • Cooldown
  • StateMachine
  • ObjectPool

Client-focused helpers

  • Mouse
  • Input
  • UI

Client-focused modules should only be required in client contexts where the corresponding services are available.

Root Exports

The package root exports all utility modules plus these dependency aliases:

  • CommonUtils.Promise
  • CommonUtils.Signal
  • CommonUtils.Janitor

Development

Install dependencies with Wally:

wally install

Focused TestEZ specs live under Tests/ and are intended to run from the Rojo project defined in test.project.json.

License

MIT

Package Details

Install command (Click to copy)


Version

0.1.0

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.