Pets and eggs for your simulator, done right
Eggs with true odds, luck and pity; hatching that charges once; a pet inventory with equip slots, locks and save/load; Golden and Rainbow fusing; pets that follow every player. Server-authoritative, tested, drag-in.
For: Roblox developers building simulators, clicker and collection games.
See it work: real output from the shipped code
100,000 hatches of the example's Cavern Egg
Run through Eggs:Roll() with a seeded server Random. Published odds come from Eggs:Odds(), the same numbers you show players before they buy. Pity (a Legendary guaranteed after 400 dry hatches) triggered 18 times.
| Pet | Rarity | Published | Hatched | Share | |
|---|---|---|---|---|---|
| ● Fox | Uncommon | 55% | 54,957 | 54.96% | |
| ● Kitty | Rare | 33% | 33,101 | 33.10% | |
| ● Owl | Epic | 11% | 10,916 | 10.92% | |
| ● Drake | Legendary | 0.99% | 1,020 | 1.02% | |
| ● Voidling | Secret | 0.01% | 6 | 0.01% |
With a 2x luck pass the same egg shows: Fox 37.9%, Kitty 45.5%, Owl 15.2%, Drake 1.37%, Voidling 0.01%.
A triple hatch through Hatcher:Hatch(player, "Meadow Egg", 3)
Charged once (300 Coins), three pets added, then EquipBest(): total power 22.
What's inside
| Module | Runs on | What it does | Lines |
|---|---|---|---|
| Eggs | Server (Odds: both) | Egg definitions, weighted rolls with luck and pity, and the true odds to show players. | 196 |
| Hatcher | Server | The server side of hatching. | 157 |
| PetInventory | Server | One player's pets with unique ids, equip slots, locks, capacity and save/load. | 264 |
| Fuser | Server | Combine copies of the same pet into the next tier (Normal -> Golden -> Rainbow …). | 77 |
| PetBook | Shared | Every pet in your game, its rarity, its power and its tiers (Normal, Golden, Rainbow…). | 95 |
| Formation (free) | Client | Where each equipped pet should float around its owner. | 68 |
| Signal (free) | Shared | A tiny event object so your UI and systems can react to pet changes. | 49 |
| Example script | Type | Put it in |
|---|---|---|
| HatchwrenConfig | ModuleScript | ReplicatedStorage |
| HatchwrenServer | Script | ServerScriptService |
| HatchwrenClient | LocalScript | StarterPlayer > StarterPlayerScripts |
Tested like real software
26 automated tests run in a real Luau VM against a Roblox engine mock, on two runtimes (luau-web and native Luau 0.740). They ship in the zip: cd tests && npm install && node run.mjs.
| Spec | Passing | For example |
|---|---|---|
| core | 14/14 | PetBook validates config and computes tier power … |
| demo | 1/1 | demo: 100,000 Cavern Egg hatches match the published odds |
| example | 3/3 | example server: join, hatch through the remote, coins and pets update … |
| hatcher | 8/8 | triple hatch charges once and adds 3 pets … |
Install in 5 minutes
- Drag
Hatchwren.rbxmxonto ReplicatedStorage in Roblox Studio. - Drag
HatchwrenExamples.rbxmxin and move the three scripts to the services above. - Turn on Studio access to API services and press Play.
INSTALL.mdwalks through an example place step by step.
FAQ
Is this allowed on Roblox?
Yes. It's ordinary Luau using Roblox's own services (DataStoreService, MarketplaceService, Players). Nothing bypasses Roblox rules.
Why not a free model from the Toolbox?
Free models are a fine start. Hatchwren ships its tests (26 of them, run on two Luau runtimes), validates every remote argument, and is original code with a clear licence.
Do I need Rojo?
No. Drag the .rbxmx files into Roblox Studio. A Rojo project file is included if you use it.
Can I use it in a game I sell or a client's game?
Yes: unlimited experiences, commercial or not, for you or your clients. You can't resell or share the code itself.
Is CyberMax affiliated with Roblox?
No. Roblox and Roblox Studio are trademarks of Roblox Corporation, named only to describe compatibility.