getgamestate Synchronous

Get a proxy for the active game Luau state. Use it when you need to distinguish the main game state from Actor states.

Syntax
Luau
getgamestate() -> LuaStateProxy?

Parameters

This function takes no arguments.

Returns

LuaStateProxy?

A LuaStateProxy for the game state, or nil when no active game state is available.

LuaStateProxy fields
Luau
LuaStateProxy = {Id: number, IsActorState: boolean, Event: NativeSignal}

Example

Example
Luau
local gameState = getgamestate()
if gameState then
    print("Game state ID:", gameState.Id)
end
Kawaii documentation