agentleFS
blushneybusiness-glitchblushneybusiness-glitch/roblox-omniskills/skills/rbx-combat-ranged/SKILL.md

rbx-combat-ranged

Skill0 starsChanged 3 months agoMITView on GitHub

Ranged weapons with shooter-grade feel and zero client trust — hitscan and projectile fire paths, cone spread, ADS, ammo and reload all enforced server-side. Use when the user says "add guns", "make a bow", "shooting system", "add reloading/ammo", "aim down sights", or when a gun feels laggy, sprays through walls, or exploiters fire infinitely. Do not use for the projectile physics itself (arcs, FastCast-style simulation) — load rbx-physics-projectiles — or for swords and fists — load rbx-combat-melee instead.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read: module-library.md (existing hitscan/spread/ammo modules redeploy as-is), the game's projects.md block (weapon stat table, damage …

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

rbx-combat-ranged

Laws

  1. The client aims, the server fires. The fire remote sends origin + direction only. The server clamps origin to within 10 studs of its own HumanoidRootPart position (latency tolerance), normalizes the direction, re-runs the ray, and applies damage. A client-reported hit target is a suggestion the server ignores.
  2. Fire rate is a server clock. Track last-fire timestamp per player with os.clock(); drop any shot arriving faster than the weapon's interval minus a 10% network-jitter allowance. Silently drop — never reply with an error an exploiter can calibrate against.
  3. Ammo lives on the server. Magazine count, reserve count, and reload state are server tables; the client HUD mirrors them from a replication event. A reload is a server timer (start → locked for reloadTime → magazine refilled), not a client animation callback.
  4. Hitscan under 200 studs, projectile beyond. Instant raycast suits rifles and lasers; anything slow enough to dodge (arrows, rockets, > ~250 studs/s travel) is a stepped Heartbeat raycast per rbx-physics-projectiles. Both run on the server.
  5. Spread is server math. Apply the cone deviation server-side from the weapon's spread stat so a "no-spread" client edit changes nothing.

Recipes

Spread cone: rotate the aim direction by a random angle inside the cone — pick randomAngle = math.random() * 2π around the axis and randomSpread = math.random() × rad(spreadDeg), offset along the right/up basis vectors. Baselines: rifle hip-fire 4–6°, SMG 6–8°, shotgun 12° with 8 pellets (one ray each, damage split per pellet), sniper 0° scoped. ADS multiplies spread by 0.15–0.25 and walk speed by 0.6.

ADS: client tweens FOV 70 → 45–55 over 0.15–0.2s and reports ADS state; server stores the flag and applies the spread multiplier only if the flag is set AND the player's equipped weapon supports it. ADS state is a spread input, never a damage input.

Reload: reloadTime 1.5–2.5s typical; firing during reload is rejected server-side; reload cancels on weapon switch and on death. Play the reload sound from the server-side event so nearby players hear it — audible reloads are counterplay.

Bullet drop (long-range only): split the ray into 8–12 segments, bend each successive segment down by gravity × t² for its slice of flight time. Skip drop entirely under 150 studs — players cannot perceive it there and it doubles ray cost.

Damage falloff: full damage to 40% of max range, then linear down to 60% of base at max range. Headshot = 1.5–2.0× checked by hit part name (Head), never by a client flag.

Feedback per shot: muzzle flash + tracer beam + fire sound client-side on input (prediction), impact VFX + damage number only after server confirmation. The 50–100ms gap is invisible behind the muzzle flash; showing damage before confirmation is how ghost hits are born.

Performance budget

One reused RaycastParams per weapon instance. Shotguns: 8 rays per shot is fine; 8 rays × automatic fire is not — pellet weapons are pump/semi only. Tracers are Beams pooled and retextured, not per-shot Part streaks. Server fire handler stays under 0.2ms per shot; no per-shot Instance creation on the server.

Load with

rbx-physics-projectiles — don't ask, include it (arrows, rockets, grenades all land there). rbx-vfx-beams-trails for tracers, rbx-vfx-impacts + rbx-audio-sfx for hits, rbx-input-bindings for fire/ADS/reload binds across platforms, rbx-ui-hud for the ammo counter. Validation depth: rbx-combat-hitreg; abuse throttling: rbx-net-ratelimit.

AI-tells

  • ☐ Fire remote carries a hit target or damage amount
  • ☐ Origin taken from the client without the 10-stud server clamp
  • ☐ Fire-rate, ammo, or reload tracked client-side only
  • ☐ Spread computed on the client
  • ☐ Damage numbers shown before server confirmation
  • ☐ Pellet shotgun wired to automatic fire
  • ☐ New RaycastParams built inside the fire handler
  • ☐ ADS flag multiplying damage instead of only spread

Memory

Read: module-library.md (existing hitscan/spread/ammo modules redeploy as-is), the game's projects.md block (weapon stat table, damage scale, TTK targets from rbx-pvp-balance). Write: the approved per-weapon stat block (damage, RPM, spread, reload, falloff) into projects.md; the fire-validation module into module-library.md; tracer/muzzle sprite ids into asset-library.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.