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.
Properties
Section titled “Properties”Type: string
The internal name of the item.
DisplayName
Section titled “DisplayName”Type: string?
The display name of the item. If not set, the Name is used instead.
Description
Section titled “Description”Type: string
The description of the item, displayed in the shop.
CorpseInfoDescription
Section titled “CorpseInfoDescription”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.IconContent
Section titled “IconContent”Type: Content
The asset used for the item’s icon.
IsPixelIcon
Section titled “IsPixelIcon”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.
MaxStock
Section titled “MaxStock”Type: number?
The maximum number of times a player can purchase this item in one round. If nil, there is no limit.
IsSuspicious
Section titled “IsSuspicious”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.
HoldAnimation
Section titled “HoldAnimation”Type: Content?
The animation asset to use when this item is equipped.
UnequipDisabled
Section titled “UnequipDisabled”Type: boolean?
If true, the item cannot be unequipped.
DropDisabled
Section titled “DropDisabled”Type: boolean?
If true, the item cannot be dropped, though it can still be unequipped.
PregameDisabled
Section titled “PregameDisabled”If true, the item cannot be used prior to the round starting.
ItemGroup
Section titled “ItemGroup”Type: ItemGroup?
The item group of the item. A player can only have one item of each group in their inventory at a time.
Spread
Section titled “Spread”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.
RecoilX
Section titled “RecoilX”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.
RecoilY
Section titled “RecoilY”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.
IsSilent
Section titled “IsSilent”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.
CanHeadshot
Section titled “CanHeadshot”Type: boolean?
If true, players can be headshot by this item, and will not scream when killed by a headshot.
AmmoDefinition
Section titled “AmmoDefinition”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.
ReloadDuration
Section titled “ReloadDuration”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.
UseShells
Section titled “UseShells”Type: boolean?
If true, reloading will use the shells system. No effect if a reload duration is not set.
ReloadAnimation
Section titled “ReloadAnimation”Type: Content?
An animation asset to use when reloading the item. If nil, a default not-animation will be used.
ReloadSound
Section titled “ReloadSound”Type: Sound?
The sound to play when reloading.
IsReloading
Section titled “IsReloading”Type: boolean?
When true, the item is reloading. Weapon presets do not allow the item to be used while it is reloading.
Damage
Section titled “Damage”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.
DamageKind
Section titled “DamageKind”Type: GeneralDamageSource?
The kind of damage that is applied. This is displayed in death events and on corpses. If nil, this defaults to Other.
FalloffStart
Section titled “FalloffStart”Type: number?
The distance, in studs, before damage begins to drop-off.
FalloffEnd
Section titled “FalloffEnd”Type: number?
The distance, in studs, before damage drops-off to 0.
ImpulseForce
Section titled “ImpulseForce”Type: number?
The impulse to apply on parts hit by this item. This amount is multiplied by the part’s mass.
Projectile
Section titled “Projectile”Type: MapObject?
The projectile used.
ProjectileCount
Section titled “ProjectileCount”Type: number?
The number of projectiles to spawn. This also determines the number of rays to cast for hitscan weapons.
ProjectileSpeed
Section titled “ProjectileSpeed”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.
IsProjectileSimulated
Section titled “IsProjectileSimulated”Type: boolean?
If true, projectiles will use the physics engine to register hits. Projectiles are hitscan by default.
MaxBounces
Section titled “MaxBounces”Type: number?
The maximum number of times to bounce before the projectile despawns. If nil, the projectile may only bounce once.
ShouldPlayersStopBounces
Section titled “ShouldPlayersStopBounces”Type: boolean?
If true, the projectile will despawn when making contact with a player, regardless of the number of times it has bounced.
FuseTime
Section titled “FuseTime”Type: number?
The time, in seconds, before the projectile detonates. If negative, the projectile detonates on impact.
IsAimable
Section titled “IsAimable”Type: boolean?
If true, weapon presets will allow this item to be aimed.
AimFOV
Section titled “AimFOV”Type: number?
The FOV to use when aiming. If nil, the FOV will remain unchanged.
AimSpreadMultiplier
Section titled “AimSpreadMultiplier”Type: number?
The value to multiply the spread value by when aiming. If nil, spread is unchanged when aiming.
AimAnimation
Section titled “AimAnimation”Type: Content?
The animation to use when aiming the item.
IsScopable
Section titled “IsScopable”Type: boolean?
If true, a scope overlay will appear when aiming with this item.
IsScopeRequired
Section titled “IsScopeRequired”Type: boolean?
If true, the item cannot be used unless scoped in.
HasMuzzleFlash
Section titled “HasMuzzleFlash”Type: boolean?
If true, the item has muzzle flash.
LaserColor
Section titled “LaserColor”Type: Color3?
The colour of the laser that the item uses when held. If nil, the item has no laser.
MaxDistance
Section titled “MaxDistance”Type: number?
The maximum distance that hitscan rays will be cast.
CheckInitialIntersection
Section titled “CheckInitialIntersection”Type: boolean?
If true, hitscan rays will check for any overlapping parts, and will use a boxcast to determine hits.
IsSingleUse
Section titled “IsSingleUse”Type: boolean?
If true, this item can only be used once. Once used, it will disappear from the inventory.
ExplosionInfo
Section titled “ExplosionInfo”Type: ExplosionInfo?
The properties of the explosion to create when exploding.
PrimaryToggled
Section titled “PrimaryToggled”Type: boolean?
If true, primary fire cannot be held down to trigger primary fire repeatedly.
PrimaryInterval
Section titled “PrimaryInterval”Type: number?
The time, in seconds, between each primary fire. If nil, there is no delay.
PrimaryLastUse
Section titled “PrimaryLastUse”Type: number?
The relative timestamp indicating the last time that primary fire was used.
PrimaryDisabled
Section titled “PrimaryDisabled”Type: boolean?
If true, primary fire cannot be used.
PrimaryHint
Section titled “PrimaryHint”Type: string?
The text to display for primary fire.
PrimaryAnimation
Section titled “PrimaryAnimation”Type: Content?
The animation asset to use when primary firing.
PrimarySound
Section titled “PrimarySound”Type: Sound?
The sound to play when primary firing.
HitSound
Section titled “HitSound”Type: Sound?
The sound to play when hitting something. If nil, default hitsounds will be used, depending on the hit material.
AlternateToggled
Section titled “AlternateToggled”Type: boolean?
If true, alternate fire cannot be held down to trigger alternate fire repeatedly.
AlternateInterval
Section titled “AlternateInterval”Type: number?
The time, in seconds, between each alternate fire. If nil, there is no delay.
AlternateLastUse
Section titled “AlternateLastUse”Type: number?
The relative timestamp indicating the last time that alternate fire was used.
AlternateDisabled
Section titled “AlternateDisabled”Type: boolean?
If true, alternate fire cannot be used.
AlternateHint
Section titled “AlternateHint”Type: string?
The text to display for alternate fire.
AlternateAnimation
Section titled “AlternateAnimation”Type: Content?
The animation asset to use when alternate firing.
AlternateSound
Section titled “AlternateSound”Type: Sound?
The sound to play when alternate firing.
Functions
Section titled “Functions”Functions are used to provide behaviour to items. All functions are optional.
PrimaryFireClient
Section titled “PrimaryFireClient”Specifies client-side primary fire behaviour. This function should use the Item:SetServerData() method to send data to the server.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| origin | Vector3 | The origin. |
| direction | Vector3 | The direction. |
Returns
Section titled “Returns”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.
PrimaryFireServer
Section titled “PrimaryFireServer”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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| origin | Vector3 | The origin. |
| direction | Vector3 | The direction. |
| participant | Participant | The participant. |
| data | unknown | The data provided by the client. |
Returns
Section titled “Returns”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.
PrimaryActivatedClient
Section titled “PrimaryActivatedClient”Called on the client once when primary fire begins.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
PrimaryDeactivatedClient
Section titled “PrimaryDeactivatedClient”Called on the client once when primary fire stops.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
AlternateFireClient
Section titled “AlternateFireClient”Specifies client-side alternate fire behaviour. This function should use the Item:SetServerData() method to send data to the server.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| origin | Vector3 | The origin. |
| direction | Vector3 | The direction. |
Returns
Section titled “Returns”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.
AlternateFireServer
Section titled “AlternateFireServer”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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| origin | Vector3 | The origin. |
| direction | Vector3 | The direction. |
| participant | Participant | The participant. |
| data | unknown | The data provided by the client. |
Returns
Section titled “Returns”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.
AlternateActivatedClient
Section titled “AlternateActivatedClient”Called on the client once when alternate fire begins.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
AlternateDeactivatedClient
Section titled “AlternateDeactivatedClient”Called on the client once when alternate fire stops.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
Schedules
Section titled “Schedules”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:
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| dt | number | The time delta. |
Available Schedules
Section titled “Available Schedules”HeartbeatClientPreSimulationClientPostSimulationClientPreRenderClientPreAnimationClient
Hooks are called on (or before) a specific event occuring. All hooks are optional.
BeforeHitAnything
Section titled “BeforeHitAnything”Runs before hitting anything. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| params | DamageParams | The initial DamageParams. |
| round | Round | The current round. |
Returns
Section titled “Returns”boolean
If true, the hit will continue to be processed; if false, the hit will be aborted.
BeforeHitParticipant
Section titled “BeforeHitParticipant”Runs before hitting a participant. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| params | DamageParams | The initial DamageParams. |
| participant | Participant | The participant that was hit. |
Returns
Section titled “Returns”boolean
If true, the hit will continue to be processed; if false, the hit will be aborted.
BeforeHitProp
Section titled “BeforeHitProp”Runs before hitting a prop. The part that was hit, along with other relevant info, can be retrieved from the supplied DamageParams.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| params | DamageParams | The initial DamageParams. |
| prop | Prop | The prop that was hit. |
Returns
Section titled “Returns”boolean
If true, the hit will continue to be processed; if false, the hit will be aborted.
OnEquipClient
Section titled “OnEquipClient”Called on the client whenever the item is equipped. Passive items are equipped when they are given to the player.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
OnUnequipClient
Section titled “OnUnequipClient”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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
OnEquipServer
Section titled “OnEquipServer”Called on the server whenever the item is equipped. Passive items are equipped when they are given to the player.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| participant | Participant | The participant who equipped the item. |
OnUnequipServer
Section titled “OnUnequipServer”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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| participant | Participant | The participant who unequipped the item. |
OnProjectileSpawn
Section titled “OnProjectileSpawn”Called on the server when the item’s projectile spawns. Currently only called for simulated projectiles.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| projectile | MapObject | The projectile. |
| participant | Participant | The participant who unequipped the item. |
OnProjectileSpawn
Section titled “OnProjectileSpawn”Called on the server when the item’s projectile spawns. Currently only called for simulated projectiles.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| projectile | MapObject | The projectile. |
| participant | Participant | The participant who spawned the projectile. |
OnProjectileDespawn
Section titled “OnProjectileDespawn”Called on the server when the item’s projectile despawns. Currently only called for simulated projectiles.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| item | Item | The item. |
| projectile | MapObject | The projectile. |
| participant | Participant | The participant who spawned the projectile. |