isrbxactive() → boolean
true if the Roblox window has OS focus.aliasesisgameactive, iswindowactive
lua
if isrbxactive() then mouse1click() -- only click when the game is focused end