ParaPlayer.OnStateChanged

Declaration

public void OnStateChanged(Action<AvatarStateType oldState, AvatarStateType newState> callback)

Parameter

oldStateThe player's previous state type.
newStateThe player's current state type.

Descriptions

This event fires when the state of the player is changed.

local player = ParaPlayerService.GetLocalPlayer()
player:OnStateChanged(function(stateOld, stateNew)
    print(stateOld)
    print(stateNew)
end)
player:ChangeState(AvatarStateType.Dead)