Skip to content

v1.1.0 — Weighted draws and pathfinding

Back to all updates
v1.1.0August 13, 2026

Two new modules, Chance and Navigation, and Random rounds that both can draw from.

The bundled WeightedRandom package became Chance:

local WeightedRandom = require(ReplicatedStorage.Twill.Packages.WeightedRandom)
local pool = WeightedRandom.new()
local pool = Twill.Chance.new()

Chance draws weighted outcomes you can disclose

Section titled “Chance draws weighted outcomes you can disclose”

Chance covers loot tables, drop rates and anything where some outcomes come up more often than others. Luck is an exponent per entry rather than a multiplier over the table: give common entries an exponent of zero and rare ones a positive exponent, and one luckFactor expresses every luck bonus in the game.

Roblox requires the odds of a paid random item to be shown before purchase, along with the effect of anything sold that improves them. GetProbabilities computes both, at any luck, from the table being drawn.

A pool accepts a Random round, so a weighted draw is as auditable as an even one:

local round = Twill.Random.Commit()
announce(round.Commitment)
local pool = Twill.Chance.new(round)
pool:AddItem("common", 100)
pool:AddItem("legendary", 1, 2)
local prize = pool:Next(playerLuck)
announce(round:Reveal())
Section titled “Navigation drives every agent from one loop”

Navigation turns PathfindingService routes into agents that walk, without each agent costing its own timer, thread and connections.

  • One loop drives every agent.
  • One budget bounds how many routes are worked out at once, so a crowd asking for routes in the same moment cannot stall the server.
  • Routes recompute when something blocks the part still ahead.
  • Giving up is measured as a lack of progress, not a timer against an assumed speed, so humanoids, drones and rolling boulders are judged the same way. Movement is a function the agent calls.
local agent = Twill.Navigation.new(npc, nil, bag)
agent.Arrived:Connect(onThere)
agent:GoTo(workspace.Target)

GoTo does not yield. A new goal set before the first resolves replaces it.

  • Round:NextNumber matches the method on an ordinary Random, so code that draws from one draws from a round unchanged.
  • A negative weight no longer reports odds above one for every other entry.
  • A luck factor at or below -1 no longer produces an infinite or undefined weight that returned the same entry forever.
  • The luck formula exists in one place instead of two.

Every change in this release is listed in the changelog.