Skip to content

Game data

Frame, player, and team data for live gameplay and loaded replays.

SpectatorGameTimeComponent

Class

Spectator Luau APIs for the GameTimeComponent

Methods

Method Description
getTimeSeconds Returns the shown time in decimal seconds
getSecondaryTimeSeconds Returns the secondary shown time in decimal seconds

getTimeSeconds

getTimeSeconds() -> number

Returns the shown time in decimal seconds

Returns: number


getSecondaryTimeSeconds

getSecondaryTimeSeconds() -> number

Returns the secondary shown time in decimal seconds

Returns: number

SpectatorGamemodes

Class

Spectator Gamemodes

Static functions

Method Description
listGamemodes List Gamemodes
listGamemodeIds List Gamemode Ids
getGamemodeData Get Gamemode Data
getGamemode Get Gamemode

listGamemodes

SpectatorGamemodes.listGamemodes() -> Array<ModuleStateSpectatorLuaApi>

List Gamemodes

Returns: Array<ModuleStateSpectatorLuaApi>


listGamemodeIds

SpectatorGamemodes.listGamemodeIds() -> Array<string>

List Gamemode Ids

Returns: Array<string>


getGamemodeData

SpectatorGamemodes.getGamemodeData(SlotId: string) -> SpectatorGamemodeData

Get Gamemode Data

Parameters

Name Type
SlotId string

Returns: SpectatorGamemodeData


getGamemode

SpectatorGamemodes.getGamemode(SlotId: string) -> ModuleStateSpectatorLuaApi?

Get Gamemode

Parameters

Name Type
SlotId string

Returns: ModuleStateSpectatorLuaApi?

TeamColor

Class

Team Color

Properties

Property Type Description
primary Color
secondary Color
teamLogoIndex number
teamName string
teamRowId string

ReplayBall

Class

Replay Ball

Properties

Property Type Description
transform ReplayTransform
velocity Vec3
arena number
type number
size number
index number
color1 Color
color2 Color

Methods

Method Description
toJson To Json

toJson

toJson() -> string

To Json

Returns: string

ReplayTransform

Class

Replay Transform

Properties

Property Type Description
position Vec3
rotation Quat

Methods

Method Description
toJson To Json

toJson

toJson() -> string

To Json

Returns: string

ReplayCosmeticMaterialMetadata

Class

Replay Cosmetic Material Metadata

Properties

Property Type Description
baseColor LinearColor
maskColor1 LinearColor
maskColor2 LinearColor
maskColor3 LinearColor
maskAtlasUVOffsets Vec2
logoAtlasUVOffsets Vec2

ReplayFrame

Class

The container for serializing a frame in a replay file.

Properties

Property Type Description
interpolated boolean Not serialized, used to mark interpolated frames
replayVersion number version of 0 means this frame has no real data
time DateTime
gameVersion number
players Array<ReplayPlayer> Array of all players in the game
spectators Array<ReplaySpectator> Array of all spectators in the game
balls Array<ReplayBall> Array of all balls in the game
worldTime number

Methods

Method Description
toJson To Json
getPlayerByName Get Player by Name
getPlayerById Get Player by Id
getLocalPlayer Get Local Player

toJson

toJson() -> string

To Json

Returns: string


getPlayerByName

getPlayerByName(name: string) -> Ref

Get Player by Name

Parameters

Name Type
name string

Returns: Ref


getPlayerById

getPlayerById(index: number) -> Ref

Get Player by Id

Parameters

Name Type
index number

Returns: Ref


getLocalPlayer

getLocalPlayer() -> Ref

Get Local Player

Returns: Ref

ReplaySpectator

Class

Replay Spectator

Properties

Property Type Description
playerId number Arbitrary id for the player, given by the server when they join
playerName string
isLocalPlayer boolean Is this player our own player?
ping number
transform ReplayTransform Pos/rot of the spectator

Methods

Method Description
toJson To Json

toJson

toJson() -> string

To Json

Returns: string

ReplayPlayer

Class

Replay Player

Properties

Property Type Description
playerId number Unique ID for the player. This is unique within a server, but does not identify this player across servers.
playerName string The name of the player
isLocalPlayer boolean Is this player our own player?
root ReplayTransform Transform of the player's rig
head ReplayTransform Transform of the player's camera position
leftHand ReplayTransform Transform of the player's left hand
rightHand ReplayTransform Transform of the player's right hand
velocity Vec3 Velocity of the player's rig
leftThrusterActive boolean True if using the left hand thruster
rightThrusterActive boolean True if using the right hand thruster
isBraking boolean
isBigBoosting boolean
teamIndex number
playerColor ReplayTeamColor
leftClimbing boolean
rightClimbing boolean
leftColliding boolean
rightColliding boolean
leftSliding boolean
rightSliding boolean
leftHandPosebits number
rightHandPosebits number
localClimbOffset Vec3
grabbedByAnotherPlayerCounter number
cosmeticMeshMetadataName string
cosmeticMaterialMetadata ReplayCosmeticMaterialMetadata
equippedItems Array<string>
roleColor Color
partyId number
headToFloorDistance number

Methods

Method Description
toJson To Json

toJson

toJson() -> string

To Json

Returns: string

ReplayTeamColor

Class

Replay Team Color

Properties

Property Type Description
primary Color
secondary Color
teamLogoIndex number
teamName string
teamRowId string

RayHit

Class

Ray Hit

Properties

Property Type Description
successful boolean
position Vec3
normal Vec3

SpectatorGamemodePlayer

Class

Spectator Gamemode Player

Properties

Property Type Description
playerId number
playerName string
position Vec3

SpectatorGamemodeTeamData

Class

Spectator Gamemode Team Data

Properties

Property Type Description
score number
roundsWon number
players Array<SpectatorGamemodePlayer>
teamColor TeamColor

SpectatorGamemodeData

Class

Spectator Gamemode Data

Properties

Property Type Description
slotId string
timeSeconds number
secondaryTimeSeconds number
isGameRunning boolean
totalRounds number
useBestOf boolean
teams Array<SpectatorGamemodeTeamData>