Skip to content

Folder map

ReplicatedStorage
├── Twill
├── Shared
│ ├── Remotes
│ │ └── Shop
│ └── ShopCatalog
├── Client
│ ├── Controllers
│ │ └── ShopController
│ └── Modules
│ └── Shop
│ └── ShopView
└── Assets
ServerScriptService
├── Twill
├── Main
├── Services
│ ├── CoinService
│ └── ShopService
├── Modules
│ ├── PlayerData
│ └── Shop
│ └── Pricing
└── README
ServerStorage
└── Assets
StarterPlayer
└── StarterPlayerScripts
└── Client

Every client can read everything here, whether or not the client runs it.

LocationClassHolds
TwillModuleScriptThe shared half of the foundation. Installed from a release and never edited.
SharedFolderDeclarations and pure functions both sides require. No state.
Shared/RemotesFolderOne ModuleScript per feature, declaring what a client may ask.
Shared/<Feature>CatalogModuleScriptThe public definitions of one feature: items, levels, names.
ClientFolderAll client code.
Client/ControllersFolderOne ModuleScript per feature. Lifecycle boots every one.
Client/ModulesFolderPrivate client code, in one Folder per feature.
AssetsFolderModels, interfaces, and sounds made in Studio that both sides use.
PackagesFolderThird-party packages both sides use. Create it when the first one arrives.

No client can read anything here.

LocationClassHolds
TwillModuleScriptThe server half of the foundation. Never edited.
MainScriptThe server composition root. Configures the foundation, then boots Services.
ServicesFolderOne ModuleScript per feature. Lifecycle boots every one.
ModulesFolderPrivate server code and secret definitions, in one Folder per feature.
Modules/PlayerDataModuleScriptThe saved shape of a player, and the owner of each field.
READMEModuleScriptThe rules, written for the people who work in the place.
ServerPackagesFolderThird-party packages only the server uses. Create it when the first one arrives.
LocationClassHolds
ServerStorage/AssetsFolderTemplates only the server may see.
StarterPlayerScripts/ClientLocalScriptThe client composition root. Boots Client/Controllers.
StarterGuiInterfaces made in Studio. No scripts.
WorkspaceThe world. No scripts. Behaviour binds through tags and attributes.
ReplicatedFirst/LoadingFolderA loading screen, when the game has one. It depends on no game code.

Lifecycle.Start requires every ModuleScript that is a direct child of the folder it is given. Main gives it Services, and Client gives it Client/Controllers.

Everything in those two folders boots, including a module that only holds data. A Folder inside one of them is not searched. Both facts lead to one rule: a boot folder holds entries and nothing else, and everything an entry needs lives in Modules or Shared.

ThingNameExample
Server entry<Feature>ServiceShopService
Client entry<Feature>ControllerShopController
Private codeModules/<Feature>/<What it decides>Modules/Shop/Pricing
Remote declarationsShared/Remotes/<Feature>Shared/Remotes/Shop
Public definitionsShared/<Feature>CatalogShared/ShopCatalog

Name a private module after the decision it hides: Pricing, DropTable, Matchmaking. A module named Utils, Helpers, or Manager hides no decision, so nothing says what belongs in it.

A name uses letters, digits, and _. No script is named init, and no two siblings differ by letter case alone.

The folder Shared and the module Twill.Shared are unrelated. The folder holds code both sides require. The module sends messages between servers.

DataLocation
Saved player data: template, version, migrationsServerScriptService/Modules/PlayerData
State for one player during a sessionA local table in the service that owns it, cleared from the player’s bag
Public definitionsReplicatedStorage/Shared/<Feature>Catalog
Secret definitions: drop rates, thresholdsServerScriptService/Modules/<Feature>
Values tuned while the game is liveConfig, with declared defaults
Settings of one object in the worldAttributes on the tagged instance
Templates cloned at run timeServerStorage/Assets, or ReplicatedStorage/Assets when a client clones them