How to get windows focused as a boolen value

when game is loading player might be injecting and executing scripts while the anti cheat isnt loaded yet
using uis.WindowFocusReleased:connect() works but if player joined then minimized the screen then the event wont be fired