roblox-networking
它能做什么
该技能帮助开发者以安全的方式在 Roblox 玩家设备与服务器之间创建消息。适合担心作弊、垃圾消息或游戏状态不同步的开发者。
适用场景
- ✓当你在 Roblox 游戏中设计或修复 RemoteEvents 和 RemoteFunctions 时。
- ✓当玩家可能通过发送虚假数值或大量发送远程消息来作弊时。
- ✓当游戏对象在每位玩家看来都不同,或在某些客户端上缺失时。
技能链接
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/other-engines/roblox-networking/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“玩家可以向我的 Roblox 远程事件发送虚假的伤害数值,我该如何阻止?”
每周 5 个新技能,1 分钟读完。
工作原理
该技能指导智能体列出每个远程事件及其发送方,选择正确的消息类型,只发送服务器无法自行推算的内容,并在服务器上检查每个数值。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Roblox networking
Build explicit request and replication contracts in which the server decides authoritative game
state and clients provide input or intent. Targets Roblox's rolling platform APIs. This skill goes
deeper than the networking primer in roblox-luau.
When to use
- Use to design, implement, debug, or secure cross-boundary Roblox communication.
- Use when a remote trusts client values, an exploiter can target arbitrary Instances, messages spam services, streamed objects are missing, or clients disagree with the server.
When not to use: basic Luau/services belong to roblox-luau; persistent state belongs to
roblox-datastores; physical ownership mechanics also compose with roblox-physics.
Workflow
- Inspect the existing protocol. Find every remote and both endpoints; document direction, sender, payload, frequency, authority, validation, and consumers. Reuse the canonical remote folder—do not create a duplicate because discovery was skipped.
- Classify each message. Client request, server fact, or ephemeral cosmetic sample. Choose reliable event, unreliable event, or request/response from semantics—not convenience.
- Minimize the payload. Send stable identifiers and intent. Do not send a price, damage, ownership result, arbitrary path, or computed outcome the server can derive.
- Validate in layers. Check type/shape/finiteness, allowlisted value, Instance class and ancestry, player permissions/state, distance/line of sight where relevant, server cooldown, and rate budget before doing expensive work.
- Apply on the server. The server resolves targets and mutates health, inventory, currency, cooldowns, and progression. Client-side checks improve UX but grant no trust.
- Replicate narrowly. Use
FireClientfor private or local facts; broadcast only shared facts. Avoid sending replicated properties again unless the client needs a distinct presentation event. - Handle time and lifecycle. Requests may arrive after death, respawn, streaming changes, or disconnect. Resolve the current character/state during handling and clean per-player limiter data.
- Verify with Server & Clients. Exercise normal, malformed, spam, out-of-range, stale character, rapid respawn, leaving, simultaneous players, targeted, and broadcast cases. Inspect server and each client Output separately.
Choose the transport
| Primitive | Use | Do not use |
|---|---|---|
RemoteEvent |
ordered, reliable one-way requests/facts | continuous samples where newer replaces older |
UnreliableRemoteEvent |
ephemeral cosmetic/continuous state tolerant of loss and reordering | purchases, damage decisions, inventory, one-shot state transitions |
RemoteFunction |
bounded client-to-server query that truly needs an immediate reply | server-to-client invocation; long/uncertain work; ordinary commands |
Never invoke a client synchronously from the server. A client may disconnect, error, or never
return. Prefer server RemoteEvent:FireClient() and a separate response event when needed.
Delivery rules that change handler design (per connection, per direction):
RemoteEventmessages arrive in send order, even across differentRemoteEvents, but order covers when each handler starts. A handler that yields (task.wait,WaitForChild, a DataStore call) lets the next message from the same player start before it resumes, so check-then-yield-then-apply code can approve two requests. Claim the cooldown or mark the request in progress before the first yield.- A client firing a
RemoteEventfaster than the throttle is delayed, not dropped; the backlog still arrives.UnreliableRemoteEventtraffic over the limit, over 1000 bytes, or with no handler connected is discarded. - Messages sent before a handler connects are queued (bounded) for
RemoteEvents andRemoteFunctions. There is no ordering guarantee between aRemoteFunctionand aRemoteEvent; use one remote type or your own sequence number when order matters.
Pattern: validate before resolving gameplay
-- ServerScriptService/CombatRequests.server.luau
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local attack = ReplicatedStorage.Remotes.Attack
local lastRequest: {[Player]: number} = {}
local RANGE = 12
local COOLDOWN = 0.25
attack.OnServerEvent:Connect(func
常见问题
为什么应该由服务器决定结果?
该技能让服务器掌控游戏结果,并将客户端消息视为请求,而非事实。
它涵盖基础的 Luau 吗?
不涵盖。基础脚本由另一份 Roblox Luau 技能负责。
它涵盖保存数据吗?
不涵盖。保存的数据由另一份 DataStore 技能负责。
详情
作者的原始描述
Design and harden Roblox client/server networking with RemoteEvent, RemoteFunction, and UnreliableRemoteEvent; server authority, argument and Instance validation, rate limits, proximity/ownership checks, targeted replication, streaming, lifecycle, prediction, and reconciliation. Use for Roblox remotes, exploits, request spam, multiplayer replication, network ownership, high-frequency cosmetic updates, or server/client desynchronization.
热度
- GitHub 星标
- 6.6k
- 排名
- #13839
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/28
评论
- …