跳到正文
cccskills
免费在 GitHub 公开

roblox-characters

Build Roblox character systems that keep working after death and respawn. Manage movement, animations, tools, and avatar changes by refreshing character references and cleaning up event connections, with checks for R6, R15, and custom rigs.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Build respawn-safe Roblox character systems around Players, CharacterAdded/CharacterRemoving, Humanoid, HumanoidRootPart, Animator, R6/R15 rigs, movement, animations and markers, death, tools, accessories, ownership, and custom characters. Use when character scripts break after respawn, cache stale Humanoids, control movement or velocity, load AnimationTracks, handle death, equip Tools, modify avatars, or support custom player rigs.

集成工具X (Twitter)

实测评分 未实测

查看安装方法

适用场景

  • Fix character scripts that break after respawn
  • Manage animations and event cleanup
  • Implement character movement and physical control
  • Support tools, avatar changes, and custom rigs

包含的文件(3)

  • SKILL.md8.8 KB
  • agents/openai.yaml209 B
  • references/lifecycle-and-animation.md2.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Roblox characters

Treat a Player as the durable identity and each Character as a replaceable session with its own references, connections, animation tracks, and cleanup. Targets Roblox's rolling platform APIs.

When to use

  • Use for player-character lifecycle, Humanoid state/movement, rigs, animations, tools, accessories, custom characters, death, or respawn defects.
  • Use whenever code stores a Character/Humanoid/root reference longer than one spawn.

When not to use: general physics queries and constraints belong to roblox-physics; remote trust belongs to roblox-networking; camera logic belongs to camera-systems.

Workflow

  1. Inspect the character contract. Check avatar settings, StarterCharacter, StarterCharacterScripts, CharacterAutoLoads, R6/R15 support, existing Animate/controller scripts, tools, tags, collision groups, and server/client ownership.
  2. Separate scopes. Player-scope state survives respawn; character-scope state does not. Put character connections/tracks/resources in one cleanup scope and destroy it on removal.
  3. Bind existing and future characters. Connect CharacterAdded, then bind player.Character if present. Do not assume event subscription alone sees a character that already spawned.
  4. Resolve required components defensively. Wait with a timeout where replication warrants it; validate Humanoid, root, Animator, and rig assumptions. Abort if that character is no longer current before applying delayed work.
  5. Choose movement ownership. Use Humanoid movement for standard avatars; use AssemblyLinearVelocity, BasePart:ApplyImpulse(), or a LinearVelocity/AlignPosition constraint only for mechanics that need physical control. Keep gameplay authority and network ownership implications explicit.
  6. Own animation lifecycle. Load via the rig's Animator; store tracks/connections; use named markers for gameplay timing only with server validation; stop/disconnect on character cleanup.
  7. Verify lifecycle stress. Spawn, die, reset, rapid-respawn, swap rig if supported, equip/drop tools, leave during setup, and run with at least two players when character interactions matter.

Pattern: replaceable character scope

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local generation = 0
local connections: {RBXScriptConnection} = {}
local currentCharacter: Model? = nil

local function clearCharacter()
    generation += 1
    for _, connection in connections do connection:Disconnect() end
    table.clear(connections)
    currentCharacter = nil
end

local function bindCharacter(character: Model)
    -- Guard BEFORE teardown. A stale invocation (see the CharacterAdded/defer race below) must not
    -- clear a binding that is already current, or nothing ends up bound at all.
    if player.Character ~= character then return end
    clearCharacter()
    currentCharacter = character
    local thisGeneration = generation
    local humanoid = character:WaitForChild("Humanoid", 10)
    local root = character:WaitForChild("HumanoidRootPart", 10)
    -- Re-check after the yields: a respawn during WaitForChild bumps generation and makes this call stale.
    if not humanoid or not root or generation ~= thisGeneration then return end

    table.insert(connections, humanoid.Died:Connect(function()
        if generation ~= thisGeneration then return end
        setCharacterUiEnabled(false)
    end))
    attachCurrentCharacterSystems(character, humanoid, root)
end

player.CharacterRemoving:Connect(function(character)
    if currentCharacter == character then clearCharacter() end
end)
player.CharacterAdded:Connect(bindCharacter)
if player.Character then task.defer(bindCharacter, player.Character) end

Use the project's cleanup utility when one exists; do not introduce a new framework for three connections. Server systems repeat this binding per Player and clear player-scope tables on PlayerRemoving.

Pattern: animation through Animator and markers

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://1234567890"
local track = animator:LoadAnimation(animation)
local markerConnection = track:GetMarkerReachedSignal("Commit"):Connect(function(parameter)
    playLocalSwingEffect(parameter) -- presentation; server still validates any hit
end)

track:Play(0.1)
-- On character teardown:
markerConnection:Disconnect()
track:Stop(0.1)
animation:Destroy()

For rigs without a Humanoid, use an AnimationController with an Animator. Do not use the deprecated convenience path as a substitute for owning the actual Animator and track lifecycle.

Movement and rig rules

  • Do not hardcode R15 limb names if R6 is supported. Prefer attachments, tags, or a rig-type adapter; branch on Humanoid.RigType only where topology materially differs.
  • HumanoidRootPart is the usual character assembly root, not a universal guarantee for every custom model. Define the custom rig contract and validate it at spawn.
  • Prefer Humanoid:Move()/standard controls for ordinary avatar locomotion. Directly changing AssemblyLinearVelocity is an instantaneous physical action; use forces/constraints or impulses when continuous or instantaneous physics is the real intent.
  • To rebind movement/jump or add actions like sprint, prefer the Input Action System (InputContext/InputAction/InputBinding, defined at edit time and cross-device) over hooking UserInputService directly. Default player and character control scripts run on this system when Workspace.PlayerScriptsUseInputActionSystem is enabled, exposing default PlayerScripts contexts; give your own InputContext a higher Priority (and Sink) to take precedence over the default bindings. See the roblox-ui input and navigation reference for the UI-focus side of this.
  • Check whether the place opted into the Character Controller Library (beta; Avatar Settings ⟩ Movement ⟩ Abilities) or a ControllerManager setup. Those replace HumanoidStateType-driven logic with abilities/controllers, so extend that system instead of layering Humanoid state changes on top of it.
  • Never grant damage or movement authority because a client owns its character physics. Validate cross-player consequences on the server.
  • Tools move between Backpack and Character during equip; listen to lifecycle/state rather than assuming one fixed parent. Modify accessories/appearance through current character APIs and preserve an up-to-date applied HumanoidDescription when editing avatar appearance.

Common failures

SymptomLikely causeRemedy
works once, breaks after resetcached character/Humanoid/rootrebuild per CharacterAdded; clear on removal
callbacks fire twice after deathsold character connections survivedcharacter-scoped cleanup and generation/current checks
delayed load edits wrong rigasync work outlived spawncompare current Character/generation after every yield
animation visible only locally or not at allwrong Animator/context/asset ownershipinspect rig Animator, execution side, permissions, and replication
hit marker awards impossible hitanimation marker trusted as authorityuse marker for timing/presentation; server validates combat state
R6/custom rig errorsR15 names assumeddefine rig contract; attachments/adapter; test each supported rig
tool disappears from systemfixed Backpack/Character parent assumedhandle equip/unequip ancestry and character replacement
custom force fights Humanoidtwo controllers own motionchoose one movement authority per state and restore cleanly

Resources

  • Read references/lifecycle-and-animation.md for server binding, death vs removal, rig and animation verification, custom characters, and the lifecycle stress matrix.

Related skills

  • roblox-physics — forces, constraints, assemblies, collision, and network ownership.
  • roblox-networking — server validation of character actions and stale requests.
  • input-systems — action mapping and responsive movement intent.
  • camera-systems — camera behavior following replaceable characters.

Primary references

  • https://create.roblox.com/docs/characters
  • https://create.roblox.com/docs/animation/using
  • https://create.roblox.com/docs/characters/appearance
  • https://create.roblox.com/docs/characters/character-controller-library

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Implement reusable decision systems for game characters using behavior trees, which organize conditional actions, and Utility AI, which scores available choices. Build either approach or combine them to control patrols, combat, targeting, and needs-based behavior.

中文简介正在准备中。当前显示英语简介。

  • Build a reusable behavior tree runtime
  • Choose attacks or targets using action scores
  • Combine patrol and combat trees with Utility AI
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

Design game audio with grouped volume controls, music that responds to gameplay, and varied sound effects. Plan how music lowers during dialogue and how events follow the beat, using principles that can be adapted to different game engines.

中文简介正在准备中。当前显示英语简介。

  • Plan grouped volume controls for music, effects, and dialogue
  • Lower background music while dialogue plays
  • Change music layers or segments with gameplay intensity
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

bevy-ecs

免费

Build and debug Rust games in Bevy using ECS, a way to separate game data from behavior. Organize apps and plugins, query entities, control execution order, and fix conflicting data access or frame-dependent movement.

中文简介正在准备中。当前显示英语简介。

  • Organizing a Bevy app with plugins
  • Defining components and shared resources
  • Fixing conflicting queries and execution order
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

Build and tune game cameras for smooth 2D following and 3D viewing. Covers motion smoothing, look-ahead, level boundaries, wall avoidance, and framing multiple targets, with techniques that apply across engines.

中文简介正在准备中。当前显示英语简介。

  • Smooth player-follow cameras in 2D games
  • Keep the camera view within level boundaries
  • Prevent third-person cameras from clipping through walls
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

card-game

免费

Design the core rules of a card game, including decks, hands, discards, drawing, shuffling, turns, and resource costs. Represent card effects as data and define their resolution order so card movement and gameplay outcomes follow explicit rules.

中文简介正在准备中。当前显示英语简介。

  • Building a deckbuilder or trading card game
  • Implementing draws and discard reshuffling
  • Defining turn phases and card costs
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

Plan and prepare consistent game artwork, from sprites and backgrounds to UI icons and 3D briefs. Organize asset requirements, generate or source related visuals, standardize files, and check their appearance and technical fit inside the game.

中文简介正在准备中。当前显示英语简介。

  • Create sprites and backgrounds with a consistent visual style
  • Check asset dimensions, transparency, and tile seams
  • Track asset sources and licenses before release
gamedev-skills/awesome-gamedev-agent-skills39382026年10月24日 更新

查看 gamedev-skills 的全部技能

报告此技能的问题