CyberMax
Pet Trading Kit · Trading System for Roblox developers

Pet trading that cannot duplicate a pet

Invites, a two-column trade window, a two-step confirm with a countdown, a value warning, cooldowns and trade history. Every item is checked again at the swap, both inventories change or neither does, and a DataStore journal repairs a trade if a server dies before the save. Plugs into Hatchwren pets and works with any inventory.

10 modules + 3 example scripts2,531 lines of original Luau42 tests passing.rbxmx + Rojo

For: Roblox developers adding player-to-player trading to simulators, pet games and RPGs.

See it work: a real trade, recorded from the shipped code

Ava trades a Golden Drake to Ben, and Ben tries the last-second switch

Every step below ran through Trader on the server side of the test harness. The window replays what each call returned.

Ava gives

Ben gives

After the swap

Ava has

FoxPupOwlGolden Kitty

Ben has

KittyBunnyGolden Drake

7 pets before, 7 after. Both players' trade history lists it: with Ben, gave 1, got 2.

12 tricks, each tried for real, each refused

What the client triedThe server's answer
Invite yourselfRefusedbad player
Offer the same pet twiceRefusedalready offered
Offer the other player's petRefusednot yours
Offer a locked petRefusedlocked
Offer an equipped petRefusedequipped
Send a table instead of an idRefusedbad item
Confirm before both are readyRefusednot ready
Confirm during the countdownRefusedwait for the countdown
Delete the pet after confirmingRefuseditems changed
Fire Confirm again after the trade closedRefusedno trade
Start a second trade inside the cooldownRefusedcooldown
Spam the invite remoteRefusedslow down

The server dies after the trade, before either save

Both players rejoin with the save from before the trade. The journal was written first, so trader:Recover(player) applies each side once: 1 trade for Ava, 1 for Ben, and 0 when it runs a second time.

Ava loads (stale save)

Golden DrakeFoxPup

After Recover

FoxPupOwlGolden Kitty

Ben loads (stale save)

OwlKittyGolden KittyBunny

After Recover

KittyBunnyGolden Drake

What's inside

ModuleRuns onWhat it doesLines
TraderServerThe server-side trade system.671
TradeSessionServerOne trade between two players, as a small state machine with no Roblox calls in it (so it is easy to test and to read).168
OfferServerOne player's side of a trade.127
SwapServerThe exchange itself.91
TradeLogServerTrade history, and a write-ahead journal in a DataStore that closes the classic duplication hole (player A's save lands, player B's server dies before theirs does, and the item exists twice).270
AdaptersServerThe small bridge between the trade system and wherever your game keeps items.211
Values (free)SharedWhat an item is worth, and whether a trade is lopsided.90
PolicyServerAsks Roblox whether this player may trade paid items at all.56
RateLimit (free)SharedA token bucket per player per action, so a spammed remote costs you nothing.68
Signal (free)SharedA tiny event object so your UI and systems can react to trades.49
Example scriptTypePut it in
PetTradingConfigModuleScriptReplicatedStorage
PetTradingServerScriptServerScriptService
PetTradingClientLocalScriptStarterPlayer > StarterPlayerScripts

Tested like real software

42 automated tests run in a real Luau VM against a Roblox engine mock, on luau-web 1.4.0 (Luau compiled to WebAssembly). They ship in the zip: cd tests && npm install && node run.mjs.

SpecPassingFor example
demo1/1demo: a recorded trade, the refused tricks and a crash recovery
example3/3example server: two players join with starter pets and trade through the remotes …
journal10/10a trade is written to the journal before items move, and marked saved after the save …
parts8/8RateLimit: bursts pass, sustained spam is refused, tokens refill …
session4/4offering → countdown → confirm → committing …
trader16/16a full trade: invite, accept, offer, ready, countdown, confirm, swap …

Install in 5 minutes

  1. Drag PetTradingKit.rbxmx onto ReplicatedStorage in Roblox Studio.
  2. Drag PetTradingKitExamples.rbxmx in and move the three scripts to the services above.
  3. Turn on Studio access to API services and press Play. INSTALL.md walks 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. Pet Trading Kit ships its tests (42 of them, run in a real Luau VM), 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.

More tested kits

HatchwrenPet & Egg SystemInventory Hotbar KitInventory SystemStallwrenShop & Currency SystemGavelwickAdmin CommandsMillwrenTycoon KitQuestwrenQuest & Dialogue SystemSalvowickFPS Combat FrameworkRoundmoorRound & Match SystemDevEx calculatorFree: Robux to USD at 2026 rates
Roblox and Roblox Studio are trademarks of Roblox Corporation. Pet Trading Kit is made by CyberMax and is not affiliated with or endorsed by Roblox Corporation.

Free: the Roblox Starter Kit

7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.

You get one email to confirm first. Then the kit, and 5 short emails over two weeks. One-click unsubscribe in every email; we never share your address.

$8Get Pet Trading Kit