Skip to main content

onStateChange

This event is triggered when a player's state changes.

Parameters

NameTypeDescription
newStatePlayerStateThe new state of the player
oldStatePlayerStateThe previous state of the player

Example

engine.localPlayer.events.on('onStateChange', (newState, oldState) => {
console.log('State changed: New state:', newState, 'Old state:', oldState);
});

Available on: Client