(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).WindowFocusReleased:Connect(function()ReplicatedStorageEvent:FireServer(true)end);(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).WindowFocused:Connect(function()ReplicatedStorageEvent:FireServer(false)end)local Y=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local s=game:GetService("\080\108\097\121\101\114\115")local G=s.LocalPlayer local U=false local n=0 Y.InputEnded:Connect(function()U=true n=0 while wait(1)do n+=1 if not U then break end if n>=180 then ReplicatedStorageEvent:FireServer(true)break end end end)Y.InputBegan:Connect(function()U=false ReplicatedStorageEvent:FireServer(false)end)


game:GetService("UserInputService").WindowFocusReleased:Connect(function() -- tab in
	ReplicatedStorageEvent:FireServer(true)
end)

game:GetService("UserInputService").WindowFocused:Connect(function() -- tab out
	ReplicatedStorageEvent:FireServer(false)
end)

local uis = game:GetService("UserInputService")
local plrs = game:GetService("Players")
local lplr = plrs.LocalPlayer

local idle = false
local timer  = 0
uis.InputEnded:Connect(function()
	idle = true
	timer = 0
	while wait(1) do
		timer += 1
		if not idle then
			break
		end
		if timer >= 180 then
			ReplicatedStorageEvent:FireServer(true)
			break
		end
	end
end)

uis.InputBegan:Connect(function()
	idle = false
	ReplicatedStorageEvent:FireServer(false)
end)
