Skip to content

ItemComponents

Item components define the properties and behaviours of items. When an item is instantiated, it will inherit a base set of item components which can be modified on the item without modifying the original table.

Type: string

The internal name of the item.

Type: string?

The display name of the item. If not set, the Name is used instead.

Type: string

The description of the item, displayed in the shop.

Type: string

The description shown on a body from a player with this item. Note that only passive items will show on a corpse, and only if DoNotShowInEquipmentList isn’t true.

The string can contain “%s” to substitute for the item display name with a determiner. For example, for the Jetpack:

They were wearing %s.

becomes:

They were wearing a Jetpack.

Type: Content

The asset used for the item’s icon.

Type: boolean?

If true, the icon will use a ResampleMode of Pixelated.

Type: number?

The number of credits this item costs to purchase. If nil, the item costs no credits to purchase.

Type: number?

The maximum number of times a player can purchase this item in one round. If nil, there is no limit.

Type: boolean?

If true, this item will mark players as a free kill if they are not allowed to perform suspicious actions (RoleDefinition.CanDoSuspiciousActions).

Type: MapObject?

The item model. The same model is used for the viewmodel and for the third-person item.

Type: Content?

The animation asset to use when this item is equipped.

Type: boolean?

If true, the item cannot be unequipped.

Type: boolean?

If true, the item cannot be dropped, though it can still be unequipped.

If true, the item cannot be used prior to the round starting.

Type: ItemGroup?

The item group of the item. A player can only have one item of each group in their inventory at a time.

Type: number?

The spread, in arbitrary units, of the item. This is used by the weapon presets; however, you may also choose to use it in custom item behaviour.

Type: number?

The horizontal recoil in arbitrary units. This is used by the weapon presets; however, you may also choose to use it in custom item behaviour.

Type: number?

The vertical recoil in arbitrary units. This is used by the weapon presets; however, you may also choose to use it in custom item behaviour.

Type: boolean?

If true, the item is silent and will not flash player screens red when hit. It will also not allow near-miss self-defense to be triggered.

Type: boolean?

If true, players can be headshot by this item, and will not scream when killed by a headshot.

Type: AmmoDefinition?

The ammo that this item uses.

Type: number?

The amount of ammo currently available in the item. If nil, weapon presets will not check that there is enough ammo, and will always allow the item to be fired.

Type: number?

The time, in seconds, that it takes to reload the item. Weapon presets do not allow items to be used whilst they are reloading. If UseShells is true, this sets the time it takes to insert a shell.

Type: boolean?

If true, reloading will use the shells system. No effect if a reload duration is not set.

Type: Content?

An animation asset to use when reloading the item. If nil, a default not-animation will be used.

Type: Sound?

The sound to play when reloading.

Type: boolean?

When true, the item is reloading. Weapon presets do not allow the item to be used while it is reloading.

Type: DamageInfo | number?

If this is a table, damage will be applied depending on the body part that is hit. Props take damage based on the name of the part that was hit - as such, it is possible to have a prop that takes head damage or limb damage depending on where it is hit. By default, limb damage is used.

If this is a number, the amount of damage applied is constant regardless of what is hit.

Type: GeneralDamageSource?

The kind of damage that is applied. This is displayed in death events and on corpses. If nil, this defaults to Other.

Type: number?

The distance, in studs, before damage begins to drop-off.

Type: number?

The distance, in studs, before damage drops-off to 0.

Type: number?

The impulse to apply on parts hit by this item. This amount is multiplied by the part’s mass.

Type: MapObject?

The projectile used.

Type: number?

The number of projectiles to spawn. This also determines the number of rays to cast for hitscan weapons.

Type: number?

The speed, in studs per second, of the projectile, if it is tweened. Physically simulated projectiles instead use this as the impulse to apply, multiplied by the mass of the projectile.

Type: boolean?

If true, projectiles will use the physics engine to register hits. Projectiles are hitscan by default.

Type: number?

The maximum number of times to bounce before the projectile despawns. If nil, the projectile may only bounce once.

Type: boolean?

If true, the projectile will despawn when making contact with a player, regardless of the number of times it has bounced.

Type: number?

The time, in seconds, before the projectile detonates. If negative, the projectile detonates on impact.

Type: boolean?

If true, weapon presets will allow this item to be aimed.

Type: number?

The FOV to use when aiming. If nil, the FOV will remain unchanged.

Type: number?

The value to multiply the spread value by when aiming. If nil, spread is unchanged when aiming.

Type: Content?

The animation to use when aiming the item.

Type: boolean?

If true, a scope overlay will appear when aiming with this item.

Type: boolean?

If true, the item cannot be used unless scoped in.

Type: boolean?

If true, the item has muzzle flash.

Type: Color3?

The colour of the laser that the item uses when held. If nil, the item has no laser.

Type: number?

The maximum distance that hitscan rays will be cast.

Type: boolean?

If true, hitscan rays will check for any overlapping parts, and will use a boxcast to determine hits.

Type: boolean?

If true, this item can only be used once. Once used, it will disappear from the inventory.

Type: ExplosionInfo?

The properties of the explosion to create when exploding.

Type: boolean?

If true, primary fire cannot be held down to trigger primary fire repeatedly.

Type: number?

The time, in seconds, between each primary fire. If nil, there is no delay.

Type: number?

The relative timestamp indicating the last time that primary fire was used.

Type: boolean?

If true, primary fire cannot be used.

Type: string?

The text to display for primary fire.

Type: Content?

The animation asset to use when primary firing.

Type: Sound?

The sound to play when primary firing.

Type: Sound?

The sound to play when hitting something. If nil, default hitsounds will be used, depending on the hit material.

Type: boolean?

If true, alternate fire cannot be held down to trigger alternate fire repeatedly.

Type: number?

The time, in seconds, between each alternate fire. If nil, there is no delay.

Type: number?

The relative timestamp indicating the last time that alternate fire was used.

Type: boolean?

If true, alternate fire cannot be used.

Type: string?

The text to display for alternate fire.

Type: Content?

The animation asset to use when alternate firing.

Type: Sound?

The sound to play when alternate firing.

Functions are used to provide behaviour to items. All functions are optional.

Specifies client-side primary fire behaviour. This function should use the Item:SetServerData() method to send data to the server.

NameTypeDescription
itemItemThe item.
originVector3The origin.
directionVector3The direction.

string | {string} | boolean

If returning a string or list of strings, the primary fire will be prevented with a hit rejection message. If returning a boolean, the primary fire will be blocked with no message if false - if true, the primary fire will go ahead.

Specifies server-side primary fire behaviour. This function is supplied with data from the client via the Item:SetServerData() method. Whilst the origin and direction are validated, this data is not and should be verified to prevent exploits.

NameTypeDescription
itemItemThe item.
originVector3The origin.
directionVector3The direction.
participantParticipantThe participant.
dataunknownThe data provided by the client.

string | {string}?

If returning a string or list of strings, the hit will be rejected with the provided message. If returning nil, the hit will be allowed.

Called on the client once when primary fire begins.

NameTypeDescription
itemItemThe item.

Called on the client once when primary fire stops.

NameTypeDescription
itemItemThe item.

Specifies client-side alternate fire behaviour. This function should use the Item:SetServerData() method to send data to the server.

NameTypeDescription
itemItemThe item.
originVector3The origin.
directionVector3The direction.

string | {string} | boolean

If returning a string or list of strings, the alternate fire will be prevented with a hit rejection message. If returning a boolean, the alternate fire will be blocked with no message if false - if true, the alternate fire will go ahead.

Specifies server-side alternate fire behaviour. This function is supplied with data from the client via the Item:SetServerData() method. Whilst the origin and direction are validated, this data is not and should be verified to prevent exploits.

NameTypeDescription
itemItemThe item.
originVector3The origin.
directionVector3The direction.
participantParticipantThe participant.
dataunknownThe data provided by the client.

string | {string}?

If returning a string or list of strings, the hit will be rejected with the provided message. If returning nil, the hit will be allowed.

Called on the client once when alternate fire begins.

NameTypeDescription
itemItemThe item.

Called on the client once when alternate fire stops.

NameTypeDescription
itemItemThe item.

Schedules are run on the relevant RunService event whenever the item is equipped. Passive items are always equipped.

All schedules are optional, return nothing, and are run with the following parameters:

NameTypeDescription
itemItemThe item.
dtnumberThe time delta.
  • HeartbeatClient
  • PreSimulationClient
  • PostSimulationClient
  • PreRenderClient
  • PreAnimationClient

Hooks are called on (or before) a specific event occuring. All hooks are optional.

Runs before hitting anything. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.

NameTypeDescription
itemItemThe item.
paramsDamageParamsThe initial DamageParams.
roundRoundThe current round.

boolean

If true, the hit will continue to be processed; if false, the hit will be aborted.

Runs before hitting a participant. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.

NameTypeDescription
itemItemThe item.
paramsDamageParamsThe initial DamageParams.
participantParticipantThe participant that was hit.

boolean

If true, the hit will continue to be processed; if false, the hit will be aborted.

Runs before hitting a prop. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.

NameTypeDescription
itemItemThe item.
paramsDamageParamsThe initial DamageParams.
propPropThe prop that was hit.

boolean

If true, the hit will continue to be processed; if false, the hit will be aborted.

Called on the client whenever the item is equipped. Passive items are equipped when they are given to the player.

NameTypeDescription
itemItemThe item.

Called on the client whenever the item is unequipped. This includes the item being dropped intentionally or due to death. Passive items are unequipped on death or when removed by commands.

NameTypeDescription
itemItemThe item.

Called on the server whenever the item is equipped. Passive items are equipped when they are given to the player.

NameTypeDescription
itemItemThe item.
participantParticipantThe participant who equipped the item.

Called on the server whenever the item is unequipped. This includes the item being dropped intentionally or due to death. Passive items are unequipped on death or when removed by commands.

NameTypeDescription
itemItemThe item.
participantParticipantThe participant who unequipped the item.

Called on the server when the item’s projectile spawns. Currently only called for simulated projectiles.

NameTypeDescription
itemItemThe item.
projectileMapObjectThe projectile.
participantParticipantThe participant who unequipped the item.

Called on the server when the item’s projectile spawns. Currently only called for simulated projectiles.

NameTypeDescription
itemItemThe item.
projectileMapObjectThe projectile.
participantParticipantThe participant who spawned the projectile.

Called on the server when the item’s projectile despawns. Currently only called for simulated projectiles.

NameTypeDescription
itemItemThe item.
projectileMapObjectThe projectile.
participantParticipantThe participant who spawned the projectile.