Install the skill above, then run this in your AI tool:
/roblox-luau <your description>
About
Write Luau that runs in the right place, cleans up after itself, and passes static checks before
anyone presses Play. Remote events appear here only as basic mechanics; contract design and
validation belong to `roblox-networking`.
Source
What gets added to your project
Preview every file this package writes on install before you run the command above.
Summary
>
Skill instructions
Roblox Luau scripting
Write Luau that runs in the right place, cleans up after itself, and passes static checks before
anyone presses Play. Remote events appear here only as basic mechanics; contract design and
validation belong to roblox-networking.
Workflow
Read the project setup first. Rojo *.project.json, selene.toml, .luaurc, Wally or
pesde manifests, and the place's Workspace.SignalBehavior and LuauTypeCheckMode. Follow the
existing module layout and naming instead of inventing a new one.
Decide where the code runs (table below). Check RunContext on any Script before
assuming it is server code.
Get services with game:GetService("Name") at the top of the file, not by indexing game.
Create Instances deliberately. Set properties, then Parent last, so the Instance
replicates once in its final state and change handlers do not fire for every property.
Own every connection. Store what :Connect returns and disconnect it with the object or
screen that created it; use :Once for one-shot handlers.
Share code through ModuleScripts. A module runs once per context (server, and each client
separately) and require returns the cached result, so module-level state is per context, never
shared between server and client.
Check before reporting. Run the project's static tools (below). With the Studio MCP server
connected, start_stop_play, exercise the change with execute_luau on the matching datamodel,
then read get_console_output and report any new error or warning. Without it, ask the user to
press Play and paste the Output, from both the server and client views when both sides changed.
Run only the tools the project already uses. Studio Script Sync projects may not have a sourcemap.
Where code runs
Container
Runs
Use for
ServerScriptService
server Scripts
authoritative logic; never replicated
ServerStorage
not run; server-only storage
assets and data clients must not see
ReplicatedStorage
Script with RunContext = Client runs here on clients
remotes, shared modules and assets
StarterPlayerScripts
LocalScript, once per player
persistent client systems
StarterCharacterScripts
LocalScript, once per character
per-character client logic
StarterGui
LocalScript in UI, cloned to PlayerGui
UI behavior
A LocalScript in Workspace (outside the player's character) or ServerScriptService never runs.
A Script with RunContext = Client inside a Starter* container runs twice (the original and the
clone), so keep those in ReplicatedStorage.
Patterns
Server Script: per-player setup that also covers early joiners
lua
-- ServerScriptService/Leaderboard.server.luaulocal Players = game:GetService("Players")
localfunctiononPlayerAdded(player: Player)local stats = Instance.new("Folder")
stats.Name = "leaderstats"-- this exact name shows on the default leaderboardlocal coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = stats
stats.Parent = player -- parent lastend
Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do-- players who joined before this script connected
task.spawn(onPlayerAdded, player)
end
Connection owned by its object
lua
local touchedOnce: {[Humanoid]: boolean} = {}
local connection = part.Touched:Connect(function(hit: BasePart)local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
ifnot humanoid or touchedOnce[humanoid] thenreturnend
touchedOnce[humanoid] = true
humanoid:TakeDamage(10)
task.delay(1, function() touchedOnce[humanoid] = nilend)
end)
part.Destroying:Once(function() connection:Disconnect() end)
A single shared debounce boolean blocks every other player while one is touching; key it by the
thing being debounced.
Basic remote mechanics
lua
-- LocalScript: request only. The client can send anything.local ReplicatedStorage = game:GetService("ReplicatedStorage")
local buyItem = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("BuyItem")
buyButton.Activated:Connect(function() buyItem:FireServer("sword") end)
lua
-- Script: the server looks up the price and decides.local PRICES = { sword = 100, shield = 75 }
buyItem.OnServerEvent:Connect(function(player: Player, itemId: unknown)iftype(itemId) ~= "string"thenreturnendlocal price = PRICES[itemId]
local coins = player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Coins")
ifnot price ornot coins or coins.Value < price thenreturnend
coins.Value -= price
grantItem(player, itemId)
end)
Freezing shared config turns an accidental write into an immediate error instead of a silent
per-context divergence.
Gotchas
Deferred events change ordering. When Workspace.SignalBehavior is Deferred (forced by
Server Authority, and the planned future default), handlers run at the next resumption point,
not inside the call that fired them. Code that sets a property and expects its Changed handler
to have run on the next line breaks, and a handler may see an Instance that was already
destroyed. Read state inside the handler and check instance.Parent before using it.
nil on the client right after join. Replication and streaming deliver objects over time.
Use WaitForChild (with a timeout for optional content) on the client; on the server, objects
you created exist immediately.
Legacy globals.wait(), spawn() and delay() are throttled legacy scheduling; use
task.wait, task.spawn, task.defer, task.delay.
type vs typeof.type(v) cannot tell Roblox types apart (an Instance and a CFrame both
report "userdata"); use typeof(v) to get "Instance", "CFrame" and so on.
Superseded Async methods. Many engine methods now have ...Async replacements (for example
Player:LoadCharacterAsync(), Humanoid:ApplyDescriptionAsync()). Check the API page before
using an older name in new code.
BindableEvent is not a security boundary. It only works inside one machine (server to
server, or client to client) and never replaces a remote.
Type warnings depend on the solver. Triage them against the solver and mode the place
actually uses (Workspace.UseNewLuauTypeSolver, Workspace.LuauTypeCheckMode, or a
--!strict / --!nonstrict comment), not against older behavior.
Resources
Read references/client-server.md when you need the replication timing details,
WaitForChild behavior, Bindables, Attributes and CollectionService tags, or Studio test modes.
Related skills
roblox-networking: remote contracts, validation, rate limits, replication, Server Authority.
roblox-datastores: persistence (server only).
roblox-studio-workflow: editing an existing place, Studio MCP, and test evidence.
save-systems, input-systems, game-ai: engine-neutral patterns to implement in Luau.
Version notes
Last verified: 2026-11-11.
Luau's New Type Solver reached general release in November 2025 for nocheck and non-strict
scripts. Strict-mode places opt in with Workspace.UseNewLuauTypeSolver = Enabled;
Workspace.LuauTypeCheckMode sets the default mode. The checker runs at edit time only.
SignalBehavior.Default currently behaves as Immediate; Roblox states it will become
Deferred.
Player:LoadCharacter() is deprecated in favour of LoadCharacterAsync().
Add this badge to a GitHub README so readers can open the package page and install the same version.
[](https://www.aipm-registry.com/skills/gamedev-skills/roblox-luau/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)
This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.
AI assistant context
What this skill is for
@gamedev-skills/roblox-luau@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: >
Run aipm add @gamedev-skills/roblox-luau@1.0.0 in a project that has AIPM initialized.
Supported tools
@gamedev-skills/roblox-luau@1.0.0 supports All tools.
Before installing
AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.