/roblox-skills:roblox-physicsfrom roblox-skills
Provides Roblox physics APIs: ray/block/sphere casts, overlap queries, collision groups, Touched event pitfalls, mover constraints, network ownership, CFrame math, and server authority patterns. Use when moving parts, detecting hits, building vehicles or projectiles, or fixing jitter/flinging/ownership bugs.
Ships in roblox-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
--!strict
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {} -- e.g. { character } of the shooter
params.IgnoreWater = true
local function castRay(origin: Vector3, direction: Vector3): RaycastResult?
-- direction's length is the max distance
return workspace:Raycast(origin, direction, params)
end
local result = castRay(Vector3.new(0, 50, 0), Vector3.new(0, -100, 0))
if result then
print(result.Instance, result.Position, result.Normal, result.Material, result.Distance)
end
-- Swept volumes: thick bullets, melee arcs, ground checks with width.
local sphereHit = workspace:Spherecast(Vector3.new(0, 10, 0), 2, Vector3.new(0, 0, 50), params)
local boxHit = workspace:Blockcast(CFrame.new(0, 10, 0), Vector3.new(4, 4, 4), Vector3.new(0, 0, 50), params)
-- Volume overlap: explosions, hitboxes, zone checks.
local overlap = OverlapParams.new()
overlap.FilterType = Enum.RaycastFilterType.Exclude
overlap.MaxParts = 50
local partsInBox = workspace:GetPartBoundsInBox(CFrame.new(0, 5, 0), Vector3.new(10, 10, 10), overlap)
local partsInSphere = workspace:GetPartBoundsInRadius(Vector3.zero, 15, overlap)
print(sphereHit, boxHit, #partsInBox, #partsInSphere)
FilterDescendantsInstances (or params:AddToFilter(instance)) instead
of allocating per call.params.ExcludeInstances / IncludeInstances (can be combined; exclude wins) supersede
FilterType + FilterDescendantsInstances for new code.RespectCanCollide = true to ignore non-collidable parts; CollisionGroup = "Name" to query as a group.params.Margin inflates/rounds the cast shape (a Raycast with a margin acts
as a spherecast — use a thin one where rays slip through seams); params.SizeGradient grows/shrinks it
along the cast (0.5 ends 50% larger, -1 shrinks to nothing) for cones and funnels;
workspace:Shapecast(part, direction, params, cframeOverride?, sizeOverride?) casts a part from any
pose/size without moving it (placement previews). Debug: Studio Visualization Modes → Physics → Shapecasts.GetPartsInPart(part, params) does exact geometry overlap (costlier); GetPartBoundsIn* use bounding boxes.FindPartOnRay*, Ray.new, FindPartsInRegion3* → use the APIs above.Touched fires from the physics engine, only for parts that physically contact, is fired by whoever
simulates the part (clients can spoof or suppress it for parts they own), and can fire many times per
contact. Use it for triggers (pads, pickups) with a debounce and server-side validation; use spatial
queries for hit detection and zones.
--!strict
local Players = game:GetService("Players")
local pad = Instance.new("Part")
pad.Anchored = true
pad.Parent = workspace
local recently: { [Player]: boolean } = {}
pad.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
local player = character and Players:GetPlayerFromCharacter(character)
if not player or recently[player] then
return
end
recently[player] = true
print(`{player.Name} stepped on the pad`)
task.delay(1, function()
recently[player] = nil
end)
end)
For how parts hit (impact FX, impact audio, damage by impact speed), use
BasePart:BindToCollisionSummaries(callback) instead of Touched. Once per frame after the physics step,
the callback gets every contact of that part: Part0 (the bound part), Part1, Point, Normal (points
away from Part0), RelativeVelocity (before the solver resolves the hit), Area, and Time.
CanCollide = false parts or between two sleeping parts; non-convex parts can produce
several summaries per pair. Cost scales with bound parts, not total collisions.--!strict
local function bindImpacts(part: BasePart, onImpact: (point: Vector3, speed: number) -> ()): RBXScriptConnection
return part:BindToCollisionSummaries(function(summaries: { any })
for _, summary in summaries do
local speed = math.abs(summary.RelativeVelocity:Dot(summary.Normal)) -- head-on impact speed
if speed > 10 then
onImpact(summary.Point, speed)
end
end
end)
end
return bindImpacts
--!strict
-- Collision group APIs now live on WorldRoot (workspace); the PhysicsService versions are superseded.
workspace:RegisterCollisionGroup("Players")
workspace:RegisterCollisionGroup("Ghosts")
workspace:CollisionGroupSetCollidable("Players", "Ghosts", false)
local ghost = Instance.new("Part")
ghost.CollisionGroup = "Ghosts" -- assign by name (CollisionGroupId/SetPartCollisionGroup are deprecated)
ghost.Parent = workspace
Register groups once at server start (max 32, see workspace:GetMaxCollisionGroups()). CanCollide = false removes all collisions;
CanQuery = false hides a part from raycasts; CanTouch = false disables Touched (saves CPU);
NoCollisionConstraint disables collision between two specific parts.
MeshPart collision shape: CollisionFidelity Box/Hull (cheap), Default, PreciseConvexDecomposition
(costly), or Tunable with a CollisionPrecision slider (set in Studio; scripts can't write it) to trade
precision for performance per mesh.
WeldConstraint, Motor6D, rigid constraints). It
simulates as one body; the root part (part.AssemblyRootPart) determines network ownership.WeldConstraint (keeps current offset); in code set Part0/Part1 and parent.model:PivotTo(cframe). Moving many parts at once: workspace:BulkMoveTo.AssemblyLinearVelocity/AssemblyAngularVelocity, part:ApplyImpulse(),
ApplyAngularImpulse(), AssemblyMass. Velocity/RotVelocity are deprecated.CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight).workspace.Gravity default 196.2 studs/s².| Goal | Constraint | Replaces |
|---|---|---|
| Hold/drive a velocity | LinearVelocity (VelocityConstraintMode Vector/Plane/Line) | BodyVelocity |
| Move toward a position | AlignPosition (Mode = OneAttachment + Position, Responsiveness, MaxForce) | BodyPosition |
| Rotate toward an orientation | AlignOrientation (CFrame/LookAtPosition) | BodyGyro |
| Constant force | VectorForce (RelativeTo = World) | BodyForce, BodyThrust |
| Spin | AngularVelocity | BodyAngularVelocity |
| Pull toward point | LineForce | RocketPropulsion |
| Torque | Torque | — |
All need an Attachment (Attachment0). Set MaxForce/MaxTorque realistically (not math.huge
unless intended) or objects fling. Mechanical constraints: HingeConstraint (Motor/Servo actuators for
wheels, doors), PrismaticConstraint (sliders, elevators), SpringConstraint (suspension),
RopeConstraint, RodConstraint, BallSocketConstraint, CylindricalConstraint (wheel + steering),
UniversalConstraint, RigidConstraint.
Vehicle and projectile recipes, CFrame cookbook: references/recipes.md.
part:SetNetworkOwner(nil) = server simulates (secure, laggier for players); SetNetworkOwner(player)
for a vehicle driver; SetNetworkOwnershipAuto() to restore. Call on the root part, server-side, after
the assembly is in Workspace. Anchored parts have no owner.Workspace AuthorityMode = Server makes the server simulate everything while clients predict a few
frames ahead and roll back/resimulate on mispredictions. Requirements: NextGenerationReplication,
PlayerScriptsUseInputActionSystem, SignalBehavior = Deferred, UseFixedSimulation, StreamingEnabled
(setting AuthorityMode sets these). Core rules:
RunService:BindToSimulation(fn) inside a ModuleScript required
by both server and client.Player),
not UserInputService events.AnimationTracks stay valid through reconciliation (Studio 747), but a client-only Play() on your own
character is undone when server state applies: play gameplay animations from shared simulation code.Workspace.AuthorityMode is readable by scripts, so shared modules can branch on it.player:GetCameraState() (CFrame, FieldOfView,
ViewportSize); the old camera InputAction replication no longer syncs.Fully released (opt-in) since July 2026. Details and patterns: references/server-authority.md.
MaxForce = math.huge on light parts, overlapping collisions at spawn, NaN/huge velocities.Workspace.PhysicsSteppingMethod = Adaptive) saves CPU; use fixed for precise mechanisms.roblox-security (ownership exploits), roblox-characters-animation, roblox-networking,
roblox-performance, roblox-input.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
roblox, physics, spatial-queries, raycasting, network-ownership, constraints
npx claudepluginhub el4cteo/roblox-skills --plugin roblox-skills23 skills in this plugin
/roblox-analytics-liveopsAnalytics and live ops - AnalyticsService economy/funnel/onboarding/progression/custom events, player segments, experience configs via ConfigService, A/B experiments, badges, experience notifications, timed events, daily rewards, season passes. Use when instrumenting a game, tuning economy or onboarding, running A/B tests or feature flags, or planning live events and re-engagement./roblox-architectureRoblox project structure and client/server model - replication, where code and assets belong (ServerScriptService, ReplicatedStorage, StarterPlayer), RunContext, service/controller bootstrapping, player/character lifecycle, CollectionService components, attributes, streaming-safe client code, library choices. Use when starting a project, deciding where code goes, or fixing replication/streaming bugs./roblox-audioSound and music - the Audio API (AudioPlayer, AudioEmitter, AudioListener, AudioDeviceOutput, Wire, effects, faders), classic Sound/SoundGroup, 2D vs 3D audio, music and SFX volume, client vs server playback, asset permissions, streaming caveats, voice routing, text-to-speech. Use when adding music, sound effects, spatial audio, mixing, or fixing sounds that don't play./roblox-characters-animationCharacters and animation - Humanoid properties/states, spawning (LoadCharacterAsync), health and damage, HumanoidDescription appearance, Animator/AnimationTrack playback, priorities and markers, default animation replacement, Tools, TweenService, IKControl, Character Controller Library (beta). Use when changing movement, abilities, damage, respawn, avatars, animations, tweens, or tools/weapons./roblox-code-reviewReview Roblox/Luau code for exploits, data loss, memory leaks, performance problems, lifecycle bugs, policy issues, and deprecated or superseded APIs, using a severity-ranked checklist and the full 2026 deprecation map. Use when reviewing a PR or script, auditing a game before launch, modernizing legacy code, or asked what is wrong with some Roblox code./roblox-data-storesPersistence and cross-server data - DataStoreService (UpdateAsync, retries, budgets, limits), session locking with ProfileStore, schema migrations, OrderedDataStore leaderboards, MemoryStore queues/sorted maps/hash maps, MessagingService, right-to-be-forgotten. Use when saving player data, building leaderboards or queues, or fixing data loss, duplication, or throttling.Other plugins' skills for the same job