How do I detect if a player tabs out of roblox
Use
UserInputService.WindowFocused
and
UserInputService.WindowFocusReleased
Example:
local UserInputService = game:GetService("UserInputService")
UserInputService.WindowFocusReleased:Connect(function()
print("tabbed out")
end)
local UserInputService = game:GetService("UserInputService")
UserInputService.WindowFocused:Connect(function()
print("Window focused")
end)
2 Likes
Which one means tabbed out? And opposite
WindowFocusReleased Means the window is no longer focused (tabbed out)
WindowFocused Means the window is foccused