roblox-luau
БесплатноБез исполняемых скриптовНе проверенRoblox Luau scripting and code structure: services, Instances, Script vs LocalScript vs ModuleScript, the task library and typed Luau, with selene and…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
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'sWorkspace.SignalBehaviorandLuauTypeCheckMode. Follow the existing module layout and naming instead of inventing a new one. - Decide where the code runs (table below). Check
RunContexton anyScriptbefore assuming it is server code. - Get services with
game:GetService("Name")at the top of the file, not by indexinggame. - Create Instances deliberately. Set properties, then
Parentlast, so the Instance replicates once in its final state and change handlers do not fire for every property. - Own every connection. Store what
:Connectreturns and disconnect it with the object or screen that created it; use:Oncefor one-shot handlers. - Share code through ModuleScripts. A module runs once per context (server, and each client
separately) and
requirereturns 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 withexecute_luauon the matching datamodel, then readget_console_outputand 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.
Static checks the agent can run
selene . # root selene.toml needs std = "roblox"
rojo sourcemap default.project.json --output sourcemap.json
luau-lsp analyze --sourcemap=sourcemap.json src # add Roblox type definitions; see --help
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
-- ServerScriptService/Leaderboard.server.luau
local Players = game:GetService("Players")
local function onPlayerAdded(player: Player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats" -- this exact name shows on the default leaderboard
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = stats
stats.Parent = player -- parent last
end
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
local touchedOnce: {[Humanoid]: boolean} = {}
local connection = part.Touched:Connect(function(hit: BasePart)
local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
if not humanoid or touchedOnce[humanoid] then return end
touchedOnce[humanoid] = true
humanoid:TakeDamage(10)
task.delay(1, function() touchedOnce[humanoid] = nil end)
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
-- 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)
-- Script: the server looks up the price and decides.
local PRICES = { sword = 100, shield = 75 }
buyItem.OnServerEvent:Connect(function(player: Player, itemId: unknown)
if type(itemId) ~= "string" then return end
local price = PRICES[itemId]
local leaderstats = player:FindFirstChild("leaderstats")
local coins = leaderstats and leaderstats:FindFirstChild("Coins")
if not
Установить roblox-luau в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл roblox-luau?
Roblox Luau scripting and code structure: services, Instances, Script vs LocalScript vs ModuleScript, the task library and typed Luau, with selene and luau-lsp checks. Use when a LocalScript does not run, a client gets nil after joining or wait() needs replacing. Not for remotes (`roblox-networking`), saving (`roblox-datastores`) or live-place edits (`roblox-studio-workflow`).
Как установить скилл roblox-luau?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл roblox-luau запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic