Skip to main content
Pastew
Inspiring
June 11, 2025
Solved

How to detect if player goes afk / alt + tab / alt + F4

Hello, 

I want to detect when player changes to this portrait mode after losing focus, for example when uses alt+tab or alt+f4.
I want to force release the grabbed item when this happens. How to do this?

 

Pastew
PastewAnswer
Inspiring
June 11, 2025

OK, nevermind, just found it, a minute after I posted this question..
https://developers.meta.com/horizon-worlds/reference/2.0.0/core_codeblockevents

 
this.connectCodeBlockEvent(this.entity, CodeBlockEvents.OnPlayerEnterAFK, (player: Player) => {
// do something
});



1 reply

Pastew
PastewAuthorAnswer
Inspiring
June 11, 2025

OK, nevermind, just found it, a minute after I posted this question..
https://developers.meta.com/horizon-worlds/reference/2.0.0/core_codeblockevents

 
this.connectCodeBlockEvent(this.entity, CodeBlockEvents.OnPlayerEnterAFK, (player: Player) => {
// do something
});