agentleFS
EL4CTEOEL4CTEO/roblox-skills/skills/roblox-game-systems/SKILL.md

roblox-game-systems

Skill92 starsChanged 47 days agoMITView on GitHub

Recipes for common systems built on server authority - currency service and leaderstats, XP/levels, round loops with intermission and teams, validated melee/ranged combat, inventory and tools, soft-currency shops, obby checkpoints, daily rewards, pets. Use when implementing or reviewing gameplay systems such as rounds, combat, weapons, inventories, shops, currencies, or progression.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every recipe follows the same contract:

    line 8

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Game systems recipes

Every recipe follows the same contract:

  1. State lives on the server in a service module; persistent parts go through the data layer (roblox-data-stores).
  2. Clients send intents through validated, rate-limited remotes (roblox-security, roblox-networking) and render state they receive (attributes, snapshots/deltas).
  3. Config is data: tunables in a shared/server config module (or live ConfigService configs).
  4. Lifecycle-safe: handles late joiners, respawns, leaving mid-action, and server shutdown.
SystemReference
Leaderstats, currency service, XP/levels, daily rewards, obby checkpointsreferences/progression.md
Round loop (intermission → match → results), teams, spawningreferences/round-system.md
Melee and ranged combat with server validation, cooldowns, damage attributionreferences/combat.md
Inventory, equipping tools, shop purchases (soft currency), pets that followreferences/inventory-shop.md

Currency service (the pattern every economy uses)

--!strict
-- ServerScriptService/Server/Services/CurrencyService.luau
local Players = game:GetService("Players")

type Balances = { [Player]: number }

local MAX_BALANCE = 1e12

local CurrencyService = {}
local balances: Balances = {}

local function publish(player: Player)
	player:SetAttribute("Coins", balances[player]) -- replicated to every client; UI listens
end

function CurrencyService.load(player: Player, saved: number?)
	balances[player] = math.clamp(saved or 0, 0, MAX_BALANCE)
	publish(player)
end

function CurrencyService.get(player: Player): number
	return balances[player] or 0
end

-- Positive amount only; returns the new balance.
function CurrencyService.add(player: Player, amount: number, _source: string): number?
	local balance = balances[player]
	if balance == nil or not math.isfinite(amount) or amount <= 0 then
		return nil
	end
	balances[player] = math.min(balance + math.floor(amount), MAX_BALANCE)
	publish(player)
	return balances[player]
end

-- Atomic check-and-spend; false if insufficient.
function CurrencyService.spend(player: Player, amount: number, _sink: string): boolean
	local balance = balances[player]
	if balance == nil or not math.isfinite(amount) or amount <= 0 or balance < amount then
		return false
	end
	balances[player] = balance - math.floor(amount)
	publish(player)
	return true
end

Players.PlayerRemoving:Connect(function(player)
	balances[player] = nil -- after the data layer has saved it
end)

return CurrencyService
  • One module owns each resource; nothing else writes it. Log sources/sinks to analytics (roblox-analytics-liveops).
  • The in-memory balance is saved by the data layer (ProfileStore profile.Data.coins) — or make the profile table the balance store directly.
  • For display, clients read player:GetAttribute("Coins") and GetAttributeChangedSignal("Coins"). leaderstats (a Folder with IntValues under the player) shows values in the player list.

Design checklist for any new system

  • Where does authoritative state live, and how is it persisted?
  • What can the client request, and how is each request validated and rate-limited?
  • What happens on join mid-session, respawn, leave, teleport, and server shutdown?
  • How is it tuned (config) and measured (analytics)?
  • How does it behave with 1 player, full servers, and high latency?
  • Is it streaming-safe on the client?

Related skills

roblox-architecture, roblox-security, roblox-data-stores, roblox-networking, roblox-characters-animation, roblox-monetization, roblox-ui.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.