20 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

Weapons kit

Roblox offers the following prefab weapons to assist in creating competitive combat-based games. The core system features projectile-based weapons with an over-the-shoulder camera, and setting the projectile speed high enough can simulate raycasting weapons like laser guns.

Note

The content of this project and documentation can be used under Roblox's Limited Use License.

To use a prefab weapon in your game:

  1. Select a weapon from below, navigating to the asset library link.

Pistol

 [![](https://prod.docsiteassets.roblox.com/assets/resources/weapons-kit/Weapon-Model-Shotgun.jpeg)][Marketplace-Shotgun]

Shotgun

 [![](https://prod.docsiteassets.roblox.com/assets/resources/weapons-kit/Weapon-Model-Auto-Rifle.jpeg)][Marketplace-Auto-Rifle]

Auto Rifle

Submachine Gun

Sniper Rifle

Crossbow

Grenade Launcher

Rocket Launcher

Railgun

  1. On the weapon's item page, click the Get Model button and confirm the transaction.

  2. In Studio, open the Toolbox and select your Inventory section.

  3. Locate the weapon and click it to add it into the place. When prompted whether to put the tool into the starter pack, click Yes if you want players to start with the weapon in their backpack, or click No to simply place the weapon in the 3D world as a pickup.

  4. If this is the first time bringing in a prefab weapon, move its WeaponsSystem folder into ServerScriptService to serve as the unified system folder for all prefab weapons in the game.

System folder structure

The WeaponsSystem folder is a unified folder that contains assets, configurations, and scripts that power all prefab weapons in the game. If located in ServerScriptService, it overrides any equivalent WeaponsSystem folders that may reside within individual weapons.

Within the WeaponsSystem folder, different aspects are controlled by the following ModuleScripts:

Aspect Handled primarily within...
Weapons functionality
  • `WeaponsSystem`
  • `Libraries/BaseWeapon`
  • `WeaponTypes/BulletWeapon`
  • `WeaponTypes/BowWeapon`
[Shoulder camera](#shoulder-camera)
  • `Libraries/ShoulderCamera`
[Weapons GUI](#weapons-gui)
  • `Libraries/WeaponsGui`
  • `Libraries/DirectionalIndicatorGuiManager`
  • `Libraries/DamageBillboardHandler`

Weapon structure

Prefab weapons are tools and are named as they will appear in the player's backpack. Each weapon is structured with a similar hierarchy.

Weapon type

The WeaponType StringValue corresponds with the ModuleScript for the weapon in the WeaponsSystem/WeaponTypes folder. The two base values are BulletWeapon and BowWeapon.

Weapon model

Each weapon contains a Model made up of one or more BaseParts to form the physical weapon. One of these should be set as the model's PrimaryPart.

The model also includes the following important descendants which may be parented to one of the model's BaseParts:

Configuration

The Configuration folder contains specific "value" types for weapon behavior. Beyond the defaults, you can add additional configuration items for specialized options when applicable.

As follows are the base configurations and their default values:

Item Description Default
`AimTrack` Name of the aim animation track in `Assets/Animations` of the [system folder](#system-folder-structure). `RifleAim`
`AimZoomTrack` Name of the aim zooming animation track in `Assets/Animations` of the [system folder](#system-folder-structure). `RifleAimDownSights`
`AmmoCapacity` Number of shots in each "ammo clip" before player must reload. Note that ammo is unlimited and this does not specify how much ammo a player is carrying. `30`
`BulletSpeed` Speed that bullets/projectiles travel when shot. Setting this to a very high value like `20000` simulates raycasting weapons like laser guns. `1000`
`BurstShotCooldown` Time between each shot in a burst; only matters if you set `FireMode` to `Burst`. Value of `ShotCooldown`
`FiredPlaybackSpeedRange` Amount that the pitch can vary for the `Fired` sound of the weapon. Set this to `0` to always play it at the same pitch. `0.1`
`FireMode` Choose from either `Semiautomatic` (one shot per click/tap), `Automatic` (continuous fire), or `Burst` (burst of shots equal to `NumBurstShots` on each click/tap). `Semiautomatic`
`FullDamageDistance` Maximum distance that shots will do full damage. Anything hit beyond this distance will receive less and less damage as the distance nears `ZeroDamageDistance`. `1000`
`GravityFactor` Amount that gravity should influence each bullet/projectile. For example, this value for the [Crossbow][Marketplace-Crossbow] is `1` because arrows arc during flight, but this value for the [Rocket Launcher][Marketplace-Rocket-Launcher] is `0` because propelled rockets travel straight. `0`
`HasScope` Set to `true` if you want to use the scope that's specified in [Weapons GUI](#weapons-gui). `false`
`HitDamage` Amount of damage each direct hit does. `10`
`MaxDistance` Maximum distance bullets/projectiles travel before disappearing. `2000`
`MaxSpread` Maximum amount of spread for the weapon. Value of `MinSpread`
`MinSpread` Minimum amount of spread for the weapon. `0`
`NumBurstShots` Number of shots per click/burst; only matters if you set `FireMode` to `Burst`. `3`
`NumProjectiles` Number of bullets/projectiles that will fire at the same time when you click/tap once. This is useful for weapons like the [Shotgun][Marketplace-Shotgun] that fires multiple bullets at same time. Note that one shot will always use exactly one ammo regardless of this value. `1`
`RecoilDecay` Decay multiplier for recoil; essentially the rate at which recoil diminishes after shooting. `0.825`
`RecoilDelayTime` Waiting time after shooting/clicking before recoil is added to camera. `0.07`
`RecoilMax` Maximum recoil added for each shot. `0.5`
`RecoilMin` Minimum recoil added for each shot. `0.05`
`ReloadAnimation` Name of the reload animation track in `Assets/Animations` of the [system folder](#system-folder-structure). `RifleReload`
`ShotCooldown` Minimum waiting time between clicks. For weapons with `FireMode` of `Automatic`, this is also the time between shots while pressing the fire button or holding click. `0.1`
`StartupTime` Length of time after equipping the weapon before the player can shoot. This prevents players from firing a single shot from multiple different weapons in quick succession. `0.2`
`TotalRecoilMax` Total maximum accumulated recoil. Weapon's current recoil will never exceed this value. `2`
`ZeroDamageDistance` Anything hit at or beyond this distance will receive no damage. `10000`

Specialized options

You can add/modify the following options for any weapon. These customizations require modifying either the weapon's Model, the weapon's Configuration, or both. Some configurations are dependent on others, such as muzzle particles which require the necessary children for projectile/hit effects and sounds.

Bolt animations and sounds

A weapon's bolt is the part that moves back and forth each time it's fired.

Ejected bullet casings

Weapons can include physical bullet casings that eject upon firing and fall to the ground.

Projectile/hit effects and sounds

You can configure physical projectiles for any weapon, along with Sounds, Beams, and ParticleEmitters for hit effects and other special effects.

Muzzle particles

This option emits particles from the specified ParticleEmitter at the weapon's TipAttachment Attachment when it's fired. Descendants of the weapon's configuration folder include:

Muzzle flashes

This option creates a Beam flash effect when the weapon is fired.

Particle trails

This option creates a trail of varying length from the weapon to the projectile impact point. Descendants of the weapon's configuration folder include:

Hit marks

This visual addition appears on the surface where projectiles hit and is useful for arrows, bullet holes, scorch marks, etc. Descendants of the weapon's configuration folder include:

As noted by HitMarkEffect above, you can add a part/mesh within WeaponsSystem/Assets/Effects/HitMarks to appear as a physical projectile. For example, including an arrow MeshPart and setting AlignHitMarkToNormal to false will make the arrow stick out of the surface from the direction you shot it. This Part/MeshPart/SpecialMesh may contain the following descendants:

Exploding projectiles

Projectiles can include an Explosion object to damage player characters in an area around the impact point. Descendants of the weapon's configuration folder include:

Charging weapon

A charging weapon like the Railgun must be charged up between shots before it can fire again.

Bow weapon

A bow weapon like the Crossbow can include a realistic string and arms construction, as well as a visual arrow nocked to the string.

In addition to adding model descendants, you need to apply the following:

Descendants of the weapon's weapon model include:

Weapons GUI

The core weapons system interfaces with this system to update the GUI based on things like spread of the gun, indicators for when you get hit or hit others, etc.

The WeaponsSystemGui is a ScreenGui object in WeaponsSystem/Assets that is parented to PlayerGui when the game starts. WeaponSystemGui has four descendants as follows:

Directional indicators

Directional indicators are used to show the direction of something around the player's crosshair. For example, if someone shoots you, a red semi-circle can show up around your crosshair in the direction the shot came from. Other examples include indicators to show the direction of footsteps, indirect gunfire, or even environmental objects such as chests.

To create a new indicator, add a new Frame in WeaponsSystemGui/ScalingElements/DirectionalIndicators with the following structure:

Once created, you can activate an indicator via the following command inside WeaponsSystem/Libraries/WeaponsGui where indicatorName is the string name of the indicator to activate and worldPos is the world position where the directional indicator should point:

self.DirectionalIndicatorGuiManager:ActivateDirectionalIndicator(indicatorName, worldPos)

Note

If an indicator is activated an additional time before it has had time to fade completely, a new indicator of that type will be instantiated. This allows an unlimited number of any type of indicator to be activated at the same time.

You can also activate directional indicators from outside of WeaponsGui by replacing self in the above code with the instance of WeaponsGui in your code. However, it's recommended that you activate it from inside WeaponsGui and trigger it via a RemoteEvent or a BindableEvent. For reference, see how DamageIndicator is activated within WeaponsGui.

Damage billboard

The damage billboard is used to show numbers above a character's head when they are damaged. These will only show up for the player that damaged another player's character, not for spectating players.

Damage billboards are handled in WeaponsSystem/Libraries/DamageBillboardHandler and can be activated from any client-side code as follows, where damage is the amount of damage done and adornmentPart is the part on which to adorn the billboard, such as the victim's head:

DamageBillboardHandler:ShowDamageBillboard(damage, adornmentPart)

Shoulder camera

The shoulder camera is a third-person camera that looks over the player character's right shoulder. To customize the shoulder camera, modify the variables under the -- Configuration parameters (constants) comment in the ShoulderCamera.new() function of WeaponsSystem/Libraries/ShoulderCamera. You can modify things such as field of view, offset from the character, walk speed while sprinting or zooming, etc.

Sprint and zoom

By default, the weapons system adds "sprint" capability so players can sprint by holding the Shift key, pushing fully up on the dynamic thumbstick (mobile), or pushing fully up on the left joystick (gamepad). If you want to disable sprinting, set the value of SprintEnabled within WeaponsSystem/Configuration to false.

The system also reduces player speed while they're aiming/zooming, but you can disable this behavior by setting the value of SlowZoomWalkEnabled within WeaponsSystem/Configuration to false.