roblox-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

roblox-api

roblox-api

When to Use

使用场景

Use this skill when the task is mainly about identifying or confirming the correct Roblox engine surface:
  • Finding which class or service owns a capability.
  • Checking whether a member is a property, method, event, or callback.
  • Confirming datatype constructors, properties, methods, constants, or math behavior.
  • Choosing the correct enum family and item for a property or parameter.
  • Looking up globals such as
    game
    ,
    workspace
    ,
    script
    ,
    plugin
    , or
    Enum
    .
  • Confirming built-in library behavior such as
    task
    ,
    math
    ,
    string
    ,
    table
    ,
    os
    , or
    vector
    .
  • Verifying exact parameter shapes, return values, and deprecation status before writing code.
Do not use this skill when the task is mainly about:
  • Overall Roblox project structure, code placement, or client-server responsibility.
  • Remote security, replication architecture, persistence design, or Open Cloud workflows.
  • Broader system design where API lookup is secondary to structural decisions.
当任务主要是识别或确认正确的Roblox引擎接口时使用本技能:
  • 查找哪个类或服务具备某项能力。
  • 检查某个成员属于属性、方法、事件还是回调。
  • 确认数据类型构造函数、属性、方法、常量或数学运算行为。
  • 为属性或参数选择正确的枚举族和枚举项。
  • 查询
    game
    workspace
    script
    plugin
    Enum
    等全局变量。
  • 确认
    task
    math
    string
    table
    os
    vector
    等内置库的行为。
  • 编写代码前验证具体的参数结构、返回值和废弃状态。
当任务主要涉及以下内容时不要使用本技能:
  • 整体Roblox项目结构、代码放置位置或客户端-服务器职责划分。
  • 远程调用安全、复制架构、持久化设计或Open Cloud工作流。
  • API查询仅为次要需求的广义系统设计。

Decision Rules

决策规则

  • Use this skill if the main question is "what engine API should I call or read here?"
  • Use this skill when a known problem needs the correct class, member, datatype, enum, global, or library surface.
  • Start with the narrowest surface that matches the question:
    • Class or service for engine objects and services.
    • Datatype for value objects such as
      Vector3
      ,
      CFrame
      ,
      RaycastParams
      , or
      TweenInfo
      .
    • Enum for preset values such as
      Enum.RaycastFilterType.Exclude
      .
    • Global for always-available names like
      game
      ,
      workspace
      ,
      script
      , or
      Enum
      .
    • Library for free functions under tables like
      task
      ,
      math
      ,
      table
      , or
      string
      .
  • If the task is really about where code belongs, which side owns state, or how systems should be arranged, hand off to
    roblox-core
    .
  • If the task centers on remotes, trust boundaries, replication correctness, or server authority, hand off to
    roblox-networking
    .
  • If the task centers on persistent storage, quotas, save design, or cross-server state, hand off to
    roblox-data
    .
  • If the task centers on Open Cloud, OAuth, or external integrations, hand off to
    roblox-cloud
    or
    roblox-oauth
    .
  • If a request mixes referential lookup with out-of-scope design, answer only the engine-reference portion and explicitly exclude the rest.
  • 如果核心问题是「我应该在这里调用或读取哪个引擎API?」,使用本技能。
  • 当已知问题需要匹配正确的类、成员、数据类型、枚举、全局变量或库接口时,使用本技能。
  • 从最匹配问题的最小范围接口开始查询:
    • 引擎对象和服务查询类或服务。
    • Vector3
      CFrame
      RaycastParams
      TweenInfo
      等值对象查询数据类型。
    • Enum.RaycastFilterType.Exclude
      等预设值查询枚举。
    • game
      workspace
      script
      Enum
      等始终可用的名称查询全局变量。
    • task
      math
      table
      string
      等表下的自由函数查询库。
  • 如果任务实际关注代码归属、状态所属端或系统架构方式,转交给
    roblox-core
    处理。
  • 如果任务核心是远程调用、信任边界、复制正确性或服务端权限,转交给
    roblox-networking
    处理。
  • 如果任务核心是持久化存储、配额、存档设计或跨服务器状态,转交给
    roblox-data
    处理。
  • 如果任务核心是Open Cloud、OAuth或外部集成,转交给
    roblox-cloud
    roblox-oauth
    处理。
  • 如果请求混合了参考查询和超出范围的设计需求,仅回答引擎参考相关部分,并明确排除其余内容。

Instructions

使用说明

  1. Identify the missing fact before searching:
    • Which engine object or service is responsible?
    • Which member kind is needed?
    • Which datatype or enum is expected by the API?
    • Which global or library helper fits the job?
  2. Choose the correct reference file first:
    • references/engine-overview.md
      for surface selection.
    • references/classes-reference.md
      for class, service, and member lookup.
    • references/datatypes-reference.md
      for value types and their usage.
    • references/enums-reference.md
      for enum families and items.
    • references/globals-reference.md
      for Luau and Roblox globals.
    • references/engine-library-yaml-files.md
      for built-in libraries.
    • references/datatype-yaml-files.md
      for interpreting datatype YAML shape and overloads.
  3. Confirm the exact API contract before coding:
    • Member name.
    • Member kind.
    • Parameter order and types.
    • Return type.
    • Property type.
    • Enum family and item names.
    • Deprecation or other tags.
  4. Prefer the documented modern surface when an older global or legacy form also exists:
    • Prefer
      task.wait()
      over
      wait()
      .
    • Prefer
      task.delay()
      over
      delay()
      .
    • Prefer
      game:GetService()
      for service access when clarity matters.
  5. When a datatype or library page shows overloads, read all overloads before choosing a call pattern.
  6. When a parameter or property type points to another datatype or enum, follow that dependency and confirm it separately.
  7. Keep the answer referential and implementation-facing:
    • Name the correct surface.
    • State the relevant signature or property type.
    • Mention any important enum values, tags, or constraints.
    • Do not drift into architecture, persistence, or security-system design.
  1. 查询前先确认需要补充的信息:
    • 哪个引擎对象或服务负责对应能力?
    • 需要哪种类型的成员?
    • API需要哪种数据类型或枚举?
    • 哪个全局变量或库工具适配需求?
  2. 优先选择正确的参考文件:
    • 接口选型参考
      references/engine-overview.md
    • 类、服务和成员查询参考
      references/classes-reference.md
    • 值类型及其用法参考
      references/datatypes-reference.md
    • 枚举族和枚举项参考
      references/enums-reference.md
    • Luau和Roblox全局变量参考
      references/globals-reference.md
    • 内置库参考
      references/engine-library-yaml-files.md
    • 数据类型YAML结构和重载解析参考
      references/datatype-yaml-files.md
  3. 编码前确认准确的API契约:
    • 成员名称。
    • 成员类型。
    • 参数顺序和类型。
    • 返回类型。
    • 属性类型。
    • 枚举族和枚举项名称。
    • 废弃标记或其他标签。
  4. 当存在旧的全局变量或遗留形式时,优先使用官方文档记录的现代接口:
    • 优先使用
      task.wait()
      而非
      wait()
    • 优先使用
      task.delay()
      而非
      delay()
    • 需要明确性时优先使用
      game:GetService()
      获取服务。
  5. 当数据类型或库页面存在重载时,阅读所有重载后再选择调用模式。
  6. 当参数或属性类型指向其他数据类型或枚举时,跟进该依赖并单独确认。
  7. 保持回答的参考性和面向实现的属性:
    • 给出正确的接口名称。
    • 说明相关签名或属性类型。
    • 提及任何重要的枚举值、标签或约束。
    • 不要偏离到架构、持久化或安全系统设计范畴。

Using References

参考文档使用指引

  • Open
    references/engine-overview.md
    first when the user only knows the problem and not the engine surface.
  • Open
    references/classes-reference.md
    when the question is about classes, services, or member discovery.
  • Open
    references/datatypes-reference.md
    when a value object or helper container is involved.
  • Open
    references/enums-reference.md
    when an API expects a preset constant.
  • Open
    references/globals-reference.md
    when the question involves built-in names available in scripts.
  • Open
    references/engine-library-yaml-files.md
    when the needed API lives under
    task
    ,
    math
    ,
    string
    ,
    table
    ,
    os
    ,
    utf8
    ,
    coroutine
    ,
    debug
    ,
    buffer
    ,
    bit32
    , or
    vector
    .
  • Open
    references/datatype-yaml-files.md
    when constructor overloads, mutable-vs-immutable behavior, constants, or member lists need careful interpretation.
  • 当用户仅知道问题但不清楚对应引擎接口时,优先打开
    references/engine-overview.md
  • 当问题涉及类、服务或成员查找时,打开
    references/classes-reference.md
  • 当涉及值对象或辅助容器时,打开
    references/datatypes-reference.md
  • 当API需要预设常量时,打开
    references/enums-reference.md
  • 当问题涉及脚本中可用的内置名称时,打开
    references/globals-reference.md
  • 当所需API属于
    task
    math
    string
    table
    os
    utf8
    coroutine
    debug
    buffer
    bit32
    vector
    下时,打开
    references/engine-library-yaml-files.md
  • 当需要仔细解读构造函数重载、可变性与不可变性行为、常量或成员列表时,打开
    references/datatype-yaml-files.md

Checklist

检查清单

  • The missing fact is identified as class, member, datatype, enum, global, or library lookup.
  • The chosen engine surface is the narrowest one that matches the problem.
  • Member kind, parameter order, return type, and property type are confirmed before use.
  • Required enum family and item names are spelled exactly.
  • Datatype constructors or methods match the documented overload.
  • Deprecated globals or legacy forms are not recommended unless necessary for compatibility.
  • The response stays referential and does not drift into project architecture, persistence, or cloud workflows.
  • Out-of-scope systems are handed off to the proper Roblox skill when needed.
  • 已确认需要补充的信息属于类、成员、数据类型、枚举、全局变量或库查询范畴。
  • 选择的引擎接口是最匹配问题的最小范围接口。
  • 使用前已确认成员类型、参数顺序、返回类型和属性类型。
  • 所需的枚举族和枚举项名称拼写完全正确。
  • 数据类型构造函数或方法与文档记录的重载匹配。
  • 除非兼容性需要,否则不推荐已废弃的全局变量或遗留形式。
  • 响应保持参考属性,不会偏离到项目架构、持久化或云工作流范畴。
  • 超出范围的系统需求会在需要时转交给对应的Roblox技能处理。

Common Mistakes

常见错误

  • Using
    roblox-api
    for project structure questions that belong to
    roblox-core
    .
  • Guessing a member name without confirming whether it is a property, method, event, or callback.
  • Passing raw numbers where an enum item is expected.
  • Treating a datatype like an Instance class, or vice versa.
  • Missing constructor overloads and choosing the wrong parameter order.
  • Recommending deprecated globals like
    wait()
    or
    delay()
    when
    task
    equivalents are the modern surface.
  • Assuming a global exists in every context, especially
    plugin
    .
  • Expanding a simple API lookup into networking, data, or cloud-system design.
  • 将属于
    roblox-core
    的项目结构问题使用
    roblox-api
    处理。
  • 未确认成员属于属性、方法、事件还是回调就猜测成员名称。
  • 在需要枚举项的位置传入原始数字。
  • 将数据类型当作Instance类处理,反之亦然。
  • 忽略构造函数重载选择了错误的参数顺序。
  • 推荐
    wait()
    delay()
    等已废弃的全局变量,而不使用
    task
    模块下的现代等价接口。
  • 假设全局变量在所有上下文都存在,尤其是
    plugin
  • 将简单的API查询扩展到网络、数据或云系统设计范畴。

Examples

示例

Choose the right surface for a raycast

为射线检测选择正确的接口

  • Class or service:
    Workspace
    (via
    WorldRoot
    behavior)
  • Method:
    Workspace:Raycast(origin, direction, raycastParams)
  • Datatype:
    RaycastParams
  • Enum:
    Enum.RaycastFilterType
  • Result datatype:
    RaycastResult
  • 类或服务:
    Workspace
    (继承
    WorldRoot
    行为)
  • 方法:
    Workspace:Raycast(origin, direction, raycastParams)
  • 数据类型:
    RaycastParams
  • 枚举:
    Enum.RaycastFilterType
  • 结果数据类型:
    RaycastResult

Confirm a tween API call

确认补间API调用

  • Class or service:
    TweenService
  • Method:
    TweenService:Create(instance, tweenInfo, propertyTable)
  • Datatype:
    TweenInfo
  • Enums often involved:
    Enum.EasingStyle
    ,
    Enum.EasingDirection
  • 类或服务:
    TweenService
  • 方法:
    TweenService:Create(instance, tweenInfo, propertyTable)
  • 数据类型:
    TweenInfo
  • 常用关联枚举:
    Enum.EasingStyle
    Enum.EasingDirection

Distinguish global, datatype, and enum usage

区分全局变量、数据类型和枚举用法

lua
local Workspace = game:GetService("Workspace")

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude

local cf = CFrame.lookAt(Vector3.new(0, 5, 10), Vector3.zero)
  • game
    is a Roblox global.
  • RaycastParams
    ,
    CFrame
    , and
    Vector3
    are datatypes.
  • Enum.RaycastFilterType.Exclude
    is an enum item.
lua
local Workspace = game:GetService("Workspace")

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude

local cf = CFrame.lookAt(Vector3.new(0, 5, 10), Vector3.zero)
  • game
    是Roblox全局变量。
  • RaycastParams
    CFrame
    Vector3
    是数据类型。
  • Enum.RaycastFilterType.Exclude
    是枚举项。