Participant
A Participant represents a player in the round. You can get a Participant using the GetParticipant API.
Properties
Section titled “Properties”Type: "Participant"
Always set to “Participant”. Used to differentiate between classes.
Extras
Section titled “Extras”Type: Extras
Extra data for the participant.
Player
Section titled “Player”Type: Player
The player associated with this participant.
Type: Round
The round that this participant is in.
SlayVotes
Section titled “SlayVotes”Type: {Participant}
A list of participants that have voted to slay this participant after being RDMed by them.
Corpse
Section titled “Corpse”Type: Corpse?
The corpse of this participant. Will always be nil if the participant is not dead.
ExtraCorpseIcons
Section titled “ExtraCorpseIcons”Type: {CorpseIcon}
A list of additional corpse icons for this participant.
CorpseSearchDistance
Section titled “CorpseSearchDistance”Type: number
The max distance that the participant can interact with a corpse from.
KillList
Section titled “KillList”Type: {Participant}
A list of participants that this participant has killed.
Scores
Section titled “Scores”Type: ScoreTable
A table of scores for this participant.
ItemPurchases
Section titled “ItemPurchases”Type: ItemPurchases
A table of items that this participant has purchased, to the number of times they have done so.
Methods
Section titled “Methods”TryAddSlayVote
Section titled “TryAddSlayVote”Attempts to add a slay vote to the participant. Will fail if the voter has already voted against this participant, or if the voter was not RDMed by this participant.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
voter | Participant | The participant that is voting to slay this participant. |
Returns
Section titled “Returns”boolean
TryPlayAnimation
Section titled “TryPlayAnimation”Attempts to play an animation on the participant’s character.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
animationId | number | The ID of the animation to play. | |
animationName | string | The name of the animation. |
Returns
Section titled “Returns”()
TryStopAnimation
Section titled “TryStopAnimation”Attempts to stop the animation with the given name on the participant’s character.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
animationName | string | The name of the animation to stop. |
Returns
Section titled “Returns”()
GetKarma
Section titled “GetKarma”Returns the karma of the participant. Returns 1000 if karma is not enabled in the current gamemode.
Returns
Section titled “Returns”number
SetKarma
Section titled “SetKarma”Sets the karma of the participant. No effect if karma is disabled in the current gamemode.
Karma is clamped between 1 and 1000. If a non-integer value is specified, it will be rounded down. If a non-finite value (NaN or infinite) is used, an error will be thrown.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
karma | number | The karma to set. |
Returns
Section titled “Returns”()
IsFreeKill
Section titled “IsFreeKill”Returns true if the participant is a free kill.
Returns
Section titled “Returns”boolean
SetFreeKill
Section titled “SetFreeKill”Sets the free kill reason of the participant. Sends a chat message to the participant with the given reason, in the form “Because you {reason}, you are now a free kill!”.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
reason | string? | The reason to set, or nil if the participant should no longer be a free kill. |
Returns
Section titled “Returns”()
GetRole
Section titled “GetRole”Returns the role of the participant. If the Participant has not yet been assigned a role, returns the default role as defined by the game (not the gamemode).
Returns
Section titled “Returns”string
SetRole
Section titled “SetRole”Sets the role of the participant to the given role definition. Unsets the role if no definition is given.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
roleDefinition | RoleDefinition? | The role definition. Unsets the role if nil. |
Returns
Section titled “Returns”()
IsEvil
Section titled “IsEvil”Returns true if the participant’s role is evil. The default role is not set to be evil.
Returns
Section titled “Returns”boolean
IsAlliedWithParticipant
Section titled “IsAlliedWithParticipant”Returns true if the participant is allied with the given participant.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
participant | Participant | The participant to check. |
Returns
Section titled “Returns”boolean
IsDamageJustifiedAgainstParticipant
Section titled “IsDamageJustifiedAgainstParticipant”Returns true if the participant is justified to deal damage to the given participant. Damage is justified if the participant is not allied with the target, or if the participant has self-defense against the target.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
target | Participant | The participant to check. |
Returns
Section titled “Returns”boolean
GetFormattedName
Section titled “GetFormattedName”Returns the participant’s username, formatted with their role colour.
Returns
Section titled “Returns”string
HasCorpseIcon
Section titled “HasCorpseIcon”Returns true if the participant already has a corpse icon of the specified name.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
corpseIconName | string | The name of the corpse icon. |
Returns
Section titled “Returns”boolean
AddCorpseIcon
Section titled “AddCorpseIcon”Adds a corpse icon when the participant is killed. This should be called before the participant is killed.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
corpseIcon | CorpseIcon | The corpse icon to add. |
Returns
Section titled “Returns”()
GetCharacter
Section titled “GetCharacter”Returns the participant’s character. Returns nil if the participant has no character.
Returns
Section titled “Returns”Model?
GetHumanoid
Section titled “GetHumanoid”Returns the participant’s humanoid. Returns nil if the participant has no humanoid.
Returns
Section titled “Returns”Humanoid?
SpawnCharacter
Section titled “SpawnCharacter”Spawns or respawns the participant’s character. The character will spawn at a random PlayerSpawn in the map, unless a morph is specified. This first calls DespawnCharacter.
Additionally, this method will reset the self-defense, slay votes, free kill status, and kill list of the participant, unless preserve is true.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
morph | Model? | A character model to use. | |
preserve | boolean? | If true, participant data will not be reset. |
Returns
Section titled “Returns”()
DespawnCharacter
Section titled “DespawnCharacter”Despawns the participant’s character, additionally dropping their items and clearing their ammo, unless preserve is true. No effect if the participant has no character.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
preserve | boolean? | If true, participant data will not be reset. |
Returns
Section titled “Returns”()
AddSelfDefenseEntry
Section titled “AddSelfDefenseEntry”Adds a self-defense entry against the specified participant for the specified duration.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
params | SelfDefenseParams | The params. |
Returns
Section titled “Returns”()
HasSelfDefenseAgainstParticipant
Section titled “HasSelfDefenseAgainstParticipant”Returns true if the participant has self-defense against the specified participant.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
participant | Participant | The participant to check. |
Returns
Section titled “Returns”boolean
SetLastDamagedBy
Section titled “SetLastDamagedBy”Sets the participant’s last attacker for the specified duration. If the participant dies to environmental causes within the specified duration, their death will be attributed to the attacker.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
attacker | Participant | The attacker. | |
duration | number | The duration. |
Returns
Section titled “Returns”()
AddScore
Section titled “AddScore”Adds the specified amount of score, for the specified reason, to the Participant. If a non-integer value is used, the amount will be rounded down.
Throws an error if amount is not finite (NaN or infinite).
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
reason | string | The reason. | |
amount | number | The amount. Can be negative. |
Returns
Section titled “Returns”()
AddCredits
Section titled “AddCredits”Adds the specified amount of credits to the Participant.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
amount | number | The amount. Can be negative. |
Returns
Section titled “Returns”()
SetCredits
Section titled “SetCredits”Sets the participant’s credits to the specified amount.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
amount | number | The amount. |
Returns
Section titled “Returns”()
DropAmmoBoxForCurrentItem
Section titled “DropAmmoBoxForCurrentItem”Attempts to drop an ammo box for the participant’s current item. Will fail if no item is held or if the current item cannot drop an ammo box.
Returns
Section titled “Returns”()
GetEquippedItem
Section titled “GetEquippedItem”Returns the participant’s currently equipped item. Returns nil if the participant has no item equipped.
Returns
Section titled “Returns”AnyItem?
SetEquippedItem
Section titled “SetEquippedItem”Attempt to set the participant’s currently equipped item.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | AnyItem | The item. | |
force | boolean? | Whether to force set the item, bypassing prevent unequip if the currently equipped item has it. |
Returns
Section titled “Returns”()
GetItems
Section titled “GetItems”Returns a table of the item name to the item, for all items in the participant’s inventory.
Returns
Section titled “Returns”{[string]: AnyItem}
GiveItemFromItemDefinition
Section titled “GiveItemFromItemDefinition”Gives the specified item to the participant. Will error if the item cannot be given.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
itemDefinition | ItemDefinition | The item definition. |
Returns
Section titled “Returns”()
DropItem
Section titled “DropItem”Attempts to drop the specified item. Will fail if the item cannot be dropped.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | AnyItem | The item. | |
throwDirection | Vector3? | The direction to throw the item. |
Returns
Section titled “Returns”()
AddItem
Section titled “AddItem”Adds the item to the participant’s inventory. Will error if the slot is already occupied.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | AnyItem | The item. |
Returns
Section titled “Returns”()
RemoveItem
Section titled “RemoveItem”Removes the item from the participant’s inventory.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | AnyItem | The item. |
Returns
Section titled “Returns”()
TryDropItem
Section titled “TryDropItem”Attempts to drop the specified item. If unsuccessful, removes the item instead. Returns true if the item was dropped.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
item | AnyItem | The item. | |
throw | boolean? | Whether to apply a throwing force or not. |
Returns
Section titled “Returns”boolean
GetItemOccupyingGroup
Section titled “GetItemOccupyingGroup”Returns AnyItem occupying the specified group. Returns nil if the group is empty.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
itemGroup | ItemGroup? | The item group. If nil, this method will always return nil. |
Returns
Section titled “Returns”AnyItem?
GetAmmo
Section titled “GetAmmo”Returns the amount of the specified ammo type the participant has. Returns 0 for invalid ammo types.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
ammoType | string | The ammo type. |
Returns
Section titled “Returns”number
SetAmmo
Section titled “SetAmmo”Sets the amount of the specified ammo type the participant has.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
ammoType | string | The ammo type. | |
amount | number | The amount. |
Returns
Section titled “Returns”()
GetAllAmmo
Section titled “GetAllAmmo”Returns a table of the ammo type to the amount of ammo the participant has.
Returns
Section titled “Returns”{[string]: number}
HasWeaponOfAmmoType
Section titled “HasWeaponOfAmmoType”Returns true if the participant has a weapon with the specified ammo type.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
ammoType | string | The ammo type. |
Returns
Section titled “Returns”boolean
PurchaseItem
Section titled “PurchaseItem”Attempts to purchase the specified item definition. Returns an ItemPurchaseResult.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
itemDefinition | ItemDefinition | The item definition. |
Returns
Section titled “Returns”ItemPurchaseResult
GetStatus
Section titled “GetStatus”Returns the status of the participant.
Returns
Section titled “Returns”ParticipantStatus
IsAlive
Section titled “IsAlive”Returns true if the participant is alive.
Returns
Section titled “Returns”boolean
TryTakeDamage
Section titled “TryTakeDamage”Attempts to deal damage, with the specified parameters. Returns true if the damage was successful.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
params | DamageParams | The damage parameters. |
Returns
Section titled “Returns”boolean
GetHealth
Section titled “GetHealth”Returns the health of the participant. Returns 0 if the participant has no humanoid.
Returns
Section titled “Returns”number
SetHealth
Section titled “SetHealth”Sets the health of the participant. Will automatically set the Humanoid.MaxHealth if needed.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
health | number | The health. |
Returns
Section titled “Returns”()
MoveToSpawn
Section titled “MoveToSpawn”Teleports the participant to a PlayerSpawn on the map.
Returns
Section titled “Returns”()
TryThrowAssembly
Section titled “TryThrowAssembly”Attempts to throw the specified assembly. Returns true if successful.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
assembly | Assembly | The assembly. | |
force | number | The force of the throw. | |
parent | Instance? | The parent to set for the assembly. | |
position | Vector3? | The initial position of the assembly. | |
direction | Vector3? | The direction to throw the assembly. | |
noForward | boolean? | Whether to teleport the assembly slightly in-front of the participant. | |
noAngularImpulse | boolean? | If true, the throw assembly will not receive a random angular impulse. |
Returns
Section titled “Returns”boolean