Skip to main content
KevinJardine
Honored Contributor
April 19, 2025
Solved

Custom UI unfocus

Is there any way to unfocus a Custom UI using a script so the player does not have to do it themselves? I have a series of UI interactions and after they are over, I want to return the player to the main environment.

KevinJardine
Honored Contributor
April 20, 2025

I got a response to this question on the Discord server and verified it works. And it is easy.

There is a player.unfocusUI() function.

So in my UI code I do something like:

return Pressable({
  onPress: (player: Player) => {    
    this.async.setTimeout(() => {player.unfocusUI()}, 3000);
}
});
 
This enables me to display a response screen for 3 seconds and then I unfocus the Custom UI. 

1 reply

KevinJardine
KevinJardineAuthorAnswer
Honored Contributor
April 20, 2025

I got a response to this question on the Discord server and verified it works. And it is easy.

There is a player.unfocusUI() function.

So in my UI code I do something like:

return Pressable({
  onPress: (player: Player) => {    
    this.async.setTimeout(() => {player.unfocusUI()}, 3000);
}
});
 
This enables me to display a response screen for 3 seconds and then I unfocus the Custom UI.