Hey everyone, I just made an AFK script. The script is supposed to blur the user’s screen and enable a gui when they don’t have roblox open, it does that, but it detects when someone sends a message.
LocalScript:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AfkEvent = ReplicatedStorage:WaitForChild("AfkEvent")
local blur = Instance.new("BlurEffect")
blur.Parent = game.Lighting
blur.Size = 0
local gui
local function focusGained()
gui = player.PlayerGui.UI.AFK.AFK
AfkEvent:FireServer(false)
gui.TextTransparency = 1
blur.Size = 0
gui.Text = "Welcome!"
gui.TextTransparency = 0
wait(1)
gui.TextTransparency = 1
end
local function focusReleased()
gui = player.PlayerGui.UI.AFK.AFK
gui.Text = "See you"
AfkEvent:FireServer(true)
blur.Size = 25
gui.TextTransparency = 0
end
UserInputService.WindowFocused:Connect(focusGained)
UserInputService.WindowFocusReleased:Connect(focusReleased)