☎️Calls

State Bags Instead of Events

For call-related functionality, we use state bags instead of events. State bags provide real-time synchronization across all clients and are more efficient for tracking call state.

Please refer to the State Bags documentation for call-related state bags:

  • inCall - Whether the player is currently in a call

  • callId - The current call ID if player is in a call

  • callStatus - Detailed call status information

Why State Bags Instead of Events?

  • Real-time synchronization - State bags automatically sync across all clients

  • Efficient - No need to manually trigger events for every state change

  • Read-only tracking - State bags are set automatically by the server

Example Usage

-- Check if player is in a call
local player = Player(source)
if player.state.inCall then
    local callId = player.state.callId
    local callStatus = player.state.callStatus
    
    print("Player is in call:", callId)
    print("Call type:", callStatus.callType)
    print("Caller:", callStatus.callerNumber)
end

For more information, see: State Bags Documentation

Last updated