iswindowactive

Checks if the game window is currently focused.

Syntax

iswindowactive() -> boolean

Aliases

  • isrbxactive
  • isgameactive

Returns

TypeDescription
booleanTrue if game window is focused

Description

iswindowactive returns whether the game window is currently active and focused. This is useful for ensuring simulated input occurs only while the game is focused.

Example

-- Only simulate input when game is focused
if iswindowactive() then
    keypress(0x20) -- Press space
    task.wait(0.1)
    keyrelease(0x20)
end

Wait for Focus

-- Wait until game is focused before executing
repeat task.wait() until iswindowactive()
print("Game is now focused!")