So, I’m making a program that detects AFK status via UserInputService with # of seconds before giving them the AFK status. but when the player returns, the timer should be canceled so it won’t give the player the AFK status.
My current script as of now…
local DURATION = 10 -- Wait # of seconds before giving the AFK status
local AFK_Status = false
UserInputService.WindowFocused:Connect(function()
AFK_Status = false
AFKEvent:FireServer(AFK_Status)
end)
UserInputService.WindowFocusReleased:Connect(function()
AFK_Status = true
spawn(function()
-- Don't know what to put next. But im not sure either if I should use spawn
end)
end)
Edit 1: It seems using the
spawn()will overlap the current release event.