
Key RequiredUniversal

--[[
Dies If Not Moving Your Character by yourself after 10 seconds.
Made By Display User T0mato.
--]]
-- Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
-- Constants
local AFK_THRESHOLD = 10 -- Time in seconds before considering player AFK
local NOTIFICATION_CONFIG = {
Duration = 5,
Position = UDim2.new(0.5, 0, 0, 10),
Size = UDim2.new(0, 200, 0, 30),
Colors = {
Color3.fromRGB(255, 0, 0), -- Red
Color3.fromRGB(0, 255, 0), -- Green
Color3.fromRGB(0, 0, 255) -- Blue
}
}
-- Create notification GUI
local function createNotificationGui()
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "AFKNotification"
ScreenGui.ResetOnSpawn = false
local NotificationFrame = Instance.new("Frame")
NotificationFrame.Name = "NotificationFrame"
NotificationFrame.Size = NOTIFICATION_CONFIG.Size
NotificationFrame.Position = NOTIFICATION_CONFIG.Position
NotificationFrame.AnchorPoint = Vector2.new(0.5, 0)
NotificationFrame.BackgroundColor3 = NOTIFICATION_CONFIG.Colors[1]
NotificationFrame.BorderSizePixel = 0
NotificationFrame.Parent = ScreenGui
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 8)
UICorner.Parent = NotificationFrame
local NotificationText = Instance.new("TextLabel")
NotificationText.Name = "NotificationText"
NotificationText.Size = UDim2.new(1, 0, 1, 0)
NotificationText.BackgroundTransparency = 1
NotificationText.Text = "Made By The Player T0mato :D"
NotificationText.TextColor3 = Color3.fromRGB(255, 255, 255)
NotificationText.Font = Enum.Font.GothamBold
NotificationText.TextSize = 14
NotificationText.Parent = NotificationFrame
return ScreenGui, NotificationFrame
end
-- Animate notification color
local function animateNotificationColor(frame)
local colorIndex = 1
local info = TweenInfo.new(2, Enum.EasingStyle.Linear)
while true do
local nextIndex = (colorIndex % #NOTIFICATION_CONFIG.Colors) + 1
local tween = TweenService:Create(frame, info, {
BackgroundColor3 = NOTIFICATION_CONFIG.Colors[nextIndex]
})
tween:Play()
tween.Completed:Wait()
colorIndex = nextIndex
task.wait()
end
end
-- AFK Detection System
local function initializeAFKDetection(player)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local lastPosition = character:WaitForChild("HumanoidRootPart").Position
local lastMovementTime = tick()
-- Create and show notification
local notificationGui, notificationFrame = createNotificationGui()
notificationGui.Parent = player:WaitForChild("PlayerGui")
-- Start color animation
task.spawn(function()
animateNotificationColor(notificationFrame)
end)
-- Movement detection loop
task.spawn(function()
while true do
local currentPosition = character:WaitForChild("HumanoidRootPart").Position
if (currentPosition - lastPosition).Magnitude > 0.1 then
lastMovementTime = tick()
lastPosition = currentPosition
elseif tick() - lastMovementTime >= AFK_THRESHOLD then
-- Reset character if AFK
humanoid.Health = 0
lastMovementTime = tick()
end
task.wait(0.1)
end
end)
-- Handle character respawn
player.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
humanoid = character:WaitForChild("Humanoid")
lastPosition = character:WaitForChild("HumanoidRootPart").Position
lastMovementTime = tick()
end)
end
-- Initialize for all players
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
task.spawn(function()
initializeAFKDetection(player)
end)
end)
end)
-- Initialize for existing players
for _, player in ipairs(Players:GetPlayers()) do
task.spawn(function()
initializeAFKDetection(player)
end)
end



Lol