roblox-luau-developer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRoblox Luau 开发者
Roblox Luau Developer
用于 Roblox 项目的日常代码实现、审查和重构。默认以 Luau 和 Roblox 服务端/客户端模型为核心,不假设项目一定使用 Rojo。
For daily code implementation, review, and refactoring in Roblox projects. It centers on Luau and Roblox server/client model by default, without assuming the project uses Rojo.
工作流程
Workflow
- 先识别项目形态:
- Rojo 项目:查找 、
default.project.json、*.project.json。sourcemap.json - 包管理:查找 、
wally.toml、aftman.toml、.luaurc、selene.toml。.stylua.toml - Studio 导出:识别 、
.rbxlx、.rbxmx、.model.json、src/、ReplicatedStorage/等目录。ServerScriptService/
- Rojo 项目:查找
- 先读现有代码和命名约定,再改动:
- 用 搜索服务、模块、Remote 名、Attribute 名、CollectionService Tag。
rg - 找清楚 ServerScript、LocalScript、ModuleScript 的调用方向。
- 不凭空发明 Instance 路径、Remote 名或 UI 控件名。
- 用
- 实现时保持 Roblox 分层:
- 权威状态和校验在服务端。
- 客户端只负责输入、显示、预测和请求。
- Remote 参数必须做类型和权限校验。
- DataStore 写入需要节流、重试和失败处理。
- 优先小改动:
- 保持现有 Module 返回形态、服务名和 require 方式。
- 公共模块避免隐式全局状态。
- 对共享表和连接对象给出清理路径。
- 验证:
- 如果有 、
selene、stylua、luau-lsp、lune或项目脚本,优先运行现有检查。rojo - 如果只能静态检查,要明确说明没有 Studio/Play Solo 运行验证。
- 如果有
- First identify the project type:
- Rojo project: Look for ,
default.project.json,*.project.json.sourcemap.json - Package management: Look for ,
wally.toml,aftman.toml,.luaurc,selene.toml..stylua.toml - Studio export: Identify directories like ,
.rbxlx,.rbxmx,.model.json,src/,ReplicatedStorage/.ServerScriptService/
- Rojo project: Look for
- Read existing code and naming conventions before making changes:
- Use to search for services, modules, Remote names, Attribute names, CollectionService Tags.
rg - Clarify the call directions of ServerScript, LocalScript, and ModuleScript.
- Do not invent Instance paths, Remote names, or UI control names out of thin air.
- Use
- Maintain Roblox layering during implementation:
- Authoritative state and validation are on the server side.
- The client is only responsible for input, display, prediction, and requests.
- Remote parameters must undergo type and permission validation.
- DataStore writes require throttling, retries, and failure handling.
- Prioritize small changes:
- Maintain the existing Module return format, service names, and require methods.
- Avoid implicit global states in public modules.
- Provide cleanup paths for shared tables and connection objects.
- Validation:
- If there are ,
selene,stylua,luau-lsp,luneor project scripts, run existing checks first.rojo - If only static checks are possible, clearly state that no Studio/Play Solo runtime validation was performed.
- If there are
常见风险
Common Risks
- 客户端直接信任货币、背包、伤害、传送等高价值请求。
- RemoteEvent 没有限流或权限检查。
- 循环里频繁创建 Instance、连接事件或调用昂贵查询。
- 、
Touched、Heartbeat没有断开连接。RenderStepped - DataStore 在玩家离开或服务器关闭时没有兜底保存。
- UI 脚本和服务端逻辑互相 require,导致运行环境错误。
- The client directly trusts high-value requests such as currency, inventory, damage, and teleportation.
- RemoteEvent lacks rate limiting or permission checks.
- Frequent creation of Instances, event connections, or expensive queries in loops.
- ,
Touched,Heartbeatare not disconnected.RenderStepped - DataStore has no fallback save when players leave or the server shuts down.
- UI scripts and server logic require each other, leading to runtime environment errors.
输出格式
Output Format
- 改动:说明改了哪些脚本和行为。
- 服务端/客户端边界:说明权威逻辑在哪一侧。
- Remote/DataStore 风险:列出新增或修改的接口风险。
- 验证:列出实际运行的检查;无法运行 Studio 时说清楚。
- Changes: Describe which scripts and behaviors were modified.
- Server/Client Boundary: Indicate which side holds the authoritative logic.
- Remote/DataStore Risks: List risks of newly added or modified interfaces.
- Validation: List the checks actually performed; clearly state if Studio runtime validation was not possible.