Skip to content

GamemodeDefinition

The GamemodeDefinition is the primary data and code container for a gamemode. It specifies basic information, like the name and the creators, and it also provides hooks to implement the gamemode’s behaviors. This is the structure that should be returned by your gamemode module.

Type: string

The internal name of the gamemode. This should match the name of the gamemode module.

Type: string?

The name that will be displayed in the UI. If not set, Name will be used instead.

Type: string

The description of the gamemode, which is not currently used. Despite this, you must still provide a description.

Type: string

Lists the authors of the gamemode. Typically, you should use Roblox usernames, starting with an @ symbol, and separated by commas. For example: @username1, @username2, @username3.

Type: number | () -> number

The minimum number of players before the round can begin. Can be a number or a function that returns a number - if a function, it will be called when the round loads.

Type: number?

If specified, this is the number of votes against a player needed before they are slain for RDM. If not specified, RDM slay is disabled.

Type: boolean?

If true, friendly fire between allies will deal damage. Otherwise, friendly fire is disabled.

Type: boolean?

If true, karma will be active and will reduce damage dealt by players with low karma. Players will gain karma for dealing good damage, and lose karma for dealing bad damage. If disabled, these effects do not occur.

Type: {[string]: AnyItemDefinition}

A dictionary specifiying all available items in the gamemode. If an item is not specified here (or in the loaded map), it will fail to load.

Type: {[string]: AmmoDefinition}

A dictionary specifying all available ammo in the gamemode. If an ammo is not specified here (or in the loaded map), it will fail to load.

Type: {[string]: InteractableDefinition}

A dictionary specifying all available interactables in the gamemode. If an interactable is not specified here (or in the loaded map), it will fail to load.

Type: {AnyItemDefinition}

A list of items to give players when they spawn.

Type: {[string]: RoleDefinition}

A dictionary of role name to definitions. This table specifies the available roles for the gamemode.

Type: RoleDefinition?

Specifies a role that can be called to investigate a corpse. If nil, no roles can be called to corpses.

These functions should be thought of as properties, more so than hooks. They should be pure, and should not have any side-effects (that is, they return a value, and do not modify the game in any other way).

Called when the round starts. Returns an amount of time, in seconds, that the round should last for.

NameTypeDescription
roundRoundThe current round.
numParticipantsnumberThe number of participants in the round.

number

Called when the round ends. Returns a Sound or nil. If returning a Sound, it will be played for all players.

NameTypeDescription
roundRoundThe current round.
victorVictorThe victor of the round.
isTimeoutbooleanWhether the round ended by timeout.

Sound?

Called when the round ends. Returns a string, which will be displayed in the event log at the end of the round. If returning nil, a default message will be displayed.

NameTypeDescription
roundRoundThe current round.
victorVictorThe victor of the round.
isTimeoutbooleanWhether the round ended by timeout.

string?

Called when the round runs out of time. Returns a Victor that will be declared the victor.

NameTypeDescription
roundRoundThe current round.

Victor

Called to allow the gamemode to clean-up after itself, if needed. This is only called if the gamemode is changed mid-round.

NameTypeDescription
roundRoundThe current round.

If present, this function determines if this gamemode can be played on the given map. Can be used to prevent loading gamemodes that would not work well on certain maps, either checking their structure or by directly checking their name.

NameTypeDescription
mapMapStructureThe map. Note that this is a MapStructure, not Map.

boolean

Hooks are functions which are run on the server when a relevant event occurs. They are used to implement the gamemode’s behaviors.

Called with a shuffled list of participants when the round starts. Used to assign roles to participants.

NameTypeDescription
roundRoundThe current round.
participants{Participant}A shuffled list of participants in the round.

Called when the round starts.

NameTypeDescription
roundRoundThe current round.

Called when the round ends.

NameTypeDescription
roundRoundThe current round.

Called when a Participant’s character is loaded. This is also called when the gamemode is swapped with some characters already spawned in.

NameTypeDescription
roundRoundThe current round.
participantParticipantThe participant whose character was loaded.
charModelThe character.

Called when a Participant dies or disconnects (when alive). This hook is only called when the round is in progress; pre-game or post-game deaths will not call this hook.

This hook is commonly used to determine if the round has been won.

NameTypeDescription
roundRoundThe current round.
participantParticipantThe participant that died or disconnected.

Called when a Participant’s corpse is identified by someone. This hook is also called when a kill is confirmed via another corpse’s kill list.

NameTypeDescription
roundRoundThe current round.
corpseCorpseThe corpse that was identified.
searcherParticipantThe participant that identified the corpse.

Called when a Participant equips / unequips an item.

NameTypeDescription
roundRoundThe current round.
participantParticipantThe participant that equipped / unequipped the item.
itemAnyItemThe item that was equipped / unequipped.
equippedbooleanWhether the item was equipped or unequipped.

Called when the round ends. Used to calculate and add additional highlights to the round.

NameTypeDescription
roundRoundThe current round.

Called before a Participant takes damage. This hook returns a boolean, which should be true if the damage should be applied, or false otherwise. This is called before item-specific BeforeHitParticipant hooks, but after BeforeHitAnything hooks.

NameTypeDescription
roundRoundThe current round.
participantParticipantThe participant that is being damaged.
paramsDamageParamsThe damage parameters.

boolean

Called before a Prop takes damage. This hook returns a boolean, which should be true if the damage should be applied, or false otherwise. This is called before item-specific BeforeHitProp hooks, but after BeforeHitAnything hooks.

NameTypeDescription
roundRoundThe current round.
propPropThe prop that is being damaged.
paramsDamageParamsThe damage parameters.

boolean

Schedules are run on the relevant RunService event whilst the gamemode is loaded.

NameTypeDescription
roundRoundThe round.
dtnumberThe time delta.
  • Heartbeat