GetPlayerInteraction
Jump to navigation
Jump to search
getPlayerInteraction
Returns the authoritative replicated interaction currently performed by a player.
Syntax
table|false getPlayerInteraction(int playerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
Returns
Returns a table containing kind, active, actionId, and startedAtMs, or false for an invalid player or when no interaction state is available.
Examples
Inspect a player's current interaction:
local interaction = getPlayerInteraction(playerId)
if interaction and interaction.active then
outputDebugString("Player interaction: " .. interaction.kind)
end
Notes
- Available only in server-side resource scripts.
- Known interaction kinds currently include
generic,mining, andsitting. - The action identifier can be used to distinguish consecutive interaction sessions.