πŸ‘œState bags

Player

phoneOpen

Returns boolean - whether the phone is open for the player

This state bag tracks whether the phone UI is currently open for a player.

Client side:

-- Read state bag
local isOpen = LocalPlayer.state.phoneOpen

Server side:

-- Read state bag
local isOpen = Player(source).state.phoneOpen

State bag change handler (client side):

AddStateBagChangeHandler('phoneOpen', ('player:%s'):format(cache.serverId), function(_, _, value)
    -- State bag handler automatically syncs PhoneOpen property

    print('[StateBag] phoneOpen changed:', value)
end)

softOpen

Returns boolean - whether the phone is soft open for the player

This state bag tracks whether the phone is in "soft open" mode (visible but only for notifications/calls, not fully opened).

Client side:

Server side:

State bag change handler (client side):


phoneDisabled

Returns boolean - whether the phone is disabled for the player

This state bag is used to globally disable phone functionality for a player. When set to true, the phone will:

  • Disconnect any active calls (both regular and video calls)

  • Close the phone UI if it's open

  • Prevent phone usage until disabled is set to false

Client side:

Server side:

State bag change handler (client side):


airplaneMode

Returns boolean - whether airplane mode is enabled for the player

This state bag tracks the airplane mode setting for a player. When set to true, the phone will:

  • Disconnect any active calls (both regular and video calls)

  • Prevent making or receiving calls

  • Update signal availability in the UI

Client side:

Server side:

State bag change handler (client side):


inCall

Returns boolean - whether the player is currently in a call

This state bag tracks whether a player is currently in an active call.

Client side:

Server side:

State bag change handler (client side):


callId

Returns number | nil - the current call ID if player is in a call, nil otherwise

This state bag tracks the current call ID for a player. The call ID is a unique identifier for each call session.

Client side:

Server side:

State bag change handler (client side):


callStatus

Returns table | nil - object containing full call details, nil if not in call

This state bag contains detailed information about the player's current call status.

Structure:

Client side:

Server side:

State bag change handler (client side):


batteryLevel

Returns number - the current battery level (0-100) for the player's phone

This state bag tracks the phone's battery level. When battery reaches 0% (drained), the phone will:

  • Disconnect any active calls (both regular and video calls)

  • Block incoming calls (caller will receive an error)

  • Block notifications from being sent/received

  • Disable signal (phone appears offline)

Note: This state bag is only available when Config.Battery.Enabled is set to true. When battery is disabled, this state bag will not be set or updated.

Client side:

Server side:

State bag change handler (client side):


Notes

  • State bags set on the server automatically replicate to all clients

  • State bags set on the client do NOT replicate to the server - use server events/exports to set them

  • All state bags are initialized when phone data is loaded

  • State bag change handlers automatically handle cleanup (disconnect calls, close UI, etc.)

  • These state bags can be used by external resources (e.g., handcuffing scripts) to disable phone functionality globally

  • Call status state bags (inCall, callId, callStatus) are set automatically by the server when calls are initiated, answered, or ended

  • Call status state bags are read-only on the client side - they are purely for tracking and modifying them won't change the call status at all

Last updated