Rewriting a Dumpster Fire Codebase

me · November 21, 2025

i was brought along to help with a rewrite for the roblox game Musical Chairs. if the game seems very simple, thats because it is.

the original codebase was from 2018 btw

THE DATASTORES

i don’t know where to start so i’ll mention the datastores first.= other games usually store data in tables, some even have session locking (usually via libraries such as ProfileStore or the older ProfileService)

so this game stores your data in a folder of ValueBase instances. some games do this, it’s not catastrophic yet. btw the inventory is stored as lists of literally all the item data in the game, just the ones you actually own have “Owned” set to true. btw the item ids are the index into these arrays. whioch are json encoded. into a StringValue and your actual datastore is also JSON encoded before being uploaded (roblox already does this; but converts it back to a table on load so you wouldnt notice in most cases. its bad here because it makes datastore editors treat it as a giant string)

by the way, there’s some buggy jsonencode behaviour that arises if you do such crimes

print(game.HttpService:JSONEncode({1,2,nil,nil,5})) -- [1,2,null,null,5]
print(game.HttpService:JSONEncode({1,2,nil,4})) -- [1,2,null,4]
print(game.HttpService:JSONEncode({[1]=1, [2]=2, [4]=4})) -- [1,2,null,4]
print(game.HttpService:JSONEncode({[1]=1,[2]=2,[5]=5})) -- [1,2] ????

the issues:

  • no session locking so its quite easy to lose data
  • also all the IDs have to be sequential otherwise youll run into issues with HttpService:JSONEncode that aren’t documented properly
  • the weird jsonencode issues which cause headaches when adding items (and make it nigh impossible to remove them without hacky workarounds)

THE EVERYTHING ELSE

was just really badly structured, error-prone, and overall poorly programmed; its not that interesting to go over the other glaring issues. the datastores make up the bulk of the problems i think anyways

ill list a few other miscellaneous things that each gave me a mild aneurysm though, in no particular order

  • the chair model is scaled at 0.001 (and so are a lot of the chair skins)
  • cosmetics have inconsistent and often broken hierarchy structures
  • simple custom gamemodes manage to be very confusing to read – comments be damned

THE FIXING

now it uses rojo and git instead of just roblox studio. that doesnt make the programming instantly better it just makes it nicer to work with imo. EVERYTHING WAS REWRITTEN UNDER THE HOOD. EVERYTHING. we went scorched earth with it. user data now uses ProfileStore so we have session locking, and dataloss is mitigated !! most importantly, THE STRINGVALUES ARE NO MORE!!!!!!!!!!!!!!!!!

so now what

the rewrite not actually finished yet as of now. but like we have lives sooooooooooooo yeah.