local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local enabled = false
local activeTween = nil
local charSerial = 0
local GUARD_DIST = 20
local MAX_SPD_MULT = 1.5
local RETURN = Vector3.new(547, 71, -345)
local RAY_DIST = 2000
local RAY_START = 1000
local ws = 0
local wsd = 0
local curHuman = nil
local wsLoop = nil
local wsChar = nil
local playerGui = player:WaitForChild("PlayerGui")
local oldGui = playerGui:FindFirstChild("AutoToggleGui")
if oldGui then oldGui:Destroy() end
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoToggleGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui
local mainFrame = Instance.new("Frame")
mainFrame.Name = "__"
mainFrame.Size = UDim2.new(0, 140, 0, 95)
mainFrame.Position = UDim2.new(1, -150, 0.5, 60)
mainFrame.BackgroundTransparency = 1
mainFrame.Parent = screenGui
local label = Instance.new("TextLabel")
label.Name = "___"
label.Size = UDim2.new(1, 0, 0, 35)
label.BackgroundTransparency = 1
label.Text = "F to toggle"
label.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextScaled = true
label.Font = Enum.Font.GothamBold
label.Parent = mainFrame
local button = Instance.new("TextButton")
button.Name = "____"
button.Size = UDim2.new(1, 0, 0, 60)
button.Position = UDim2.new(0, 0, 0, 35)
button.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
button.Text = "OFF"
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.TextScaled = true
button.Font = Enum.Font.GothamBold
button.Parent = mainFrame
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 16)
corner.Parent = button
local stroke = Instance.new("UIStroke")
stroke.Thickness = 2.5
stroke.Color = Color3.fromRGB(255, 255, 255)
stroke.Transparency = 0.6
stroke.Parent = button
local function cancelTween()
if activeTween then
activeTween:Cancel()
activeTween = nil
end
end
local function stopMove()
if curHuman then
local hrp = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
if hrp then curHuman:MoveTo(hrp.Position) end
end
end
local function updBtn()
if enabled then
button.BackgroundColor3 = Color3.fromRGB(60, 255, 100)
button.Text = "ON"
else
button.BackgroundColor3 = Color3.fromRGB(255, 60, 60)
button.Text = "OFF"
end
end
local function setWS()
local char = player.Character
if not char then return end
local hum = char:FindFirstChildOfClass("Humanoid")
if not hum then return end
if ws == 0 then
ws = hum.WalkSpeed
wsd = ws + 10
end
if enabled then hum.WalkSpeed = wsd else hum.WalkSpeed = ws end
end
local function setupWS()
local char = player.Character
if not char then return end
local hum = char:FindFirstChildOfClass("Humanoid")
if not hum then return end
if ws == 0 then
ws = hum.WalkSpeed
wsd = ws + 10
end
if wsLoop then wsLoop:Disconnect() wsLoop = nil end
if wsChar then wsChar:Disconnect() wsChar = nil end
local function onChange()
if enabled and hum and hum.Parent then hum.WalkSpeed = wsd
elseif not enabled and hum and hum.Parent then hum.WalkSpeed = ws end
end
onChange()
wsLoop = hum:GetPropertyChangedSignal("WalkSpeed"):Connect(onChange)
wsChar = player.CharacterAdded:Connect(function(nChar)
local nh = nChar:WaitForChild("Humanoid")
if nh then
hum = nh
if ws == 0 then
ws = hum.WalkSpeed
wsd = ws + 10
end
onChange()
if wsLoop then wsLoop:Disconnect() end
wsLoop = hum:GetPropertyChangedSignal("WalkSpeed"):Connect(onChange)
end
end)
end
local function toggle()
enabled = not enabled
if not enabled then
cancelTween()
stopMove()
if wsLoop then wsLoop:Disconnect() wsLoop = nil end
if wsChar then wsChar:Disconnect() wsChar = nil end
local char = player.Character
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then hum.WalkSpeed = ws end
end
else
setupWS()
end
updBtn()
end
button.MouseButton1Click:Connect(toggle)
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.F then toggle() end
end)
local function onCharAdd(char)
charSerial += 1
cancelTween()
ws = 0
wsd = 0
local hum = char:WaitForChild("Humanoid", 10)
curHuman = hum
if hum then hum.Died:Connect(cancelTween) end
task.wait(0.5)
if enabled then setupWS() else setWS() end
end
player.CharacterAdded:Connect(onCharAdd)
if player.Character then onCharAdd(player.Character) end
local function getRoot()
local char = player.Character
if not char then return nil, nil end
local hum = char:FindFirstChildOfClass("Humanoid")
local hrp = char:FindFirstChild("HumanoidRootPart")
if not hum or hum.Health <= 0 or not hrp then return nil, nil end
return char, hrp
end
local function getPos(obj)
if obj:IsA("BasePart") then return obj.Position end
if obj:IsA("Model") then return obj:GetPivot().Position end
if obj:IsA("Attachment") then return obj.WorldPosition end
return nil
end
local function parseSpd(val)
if typeof(val) == "number" then return val end
local txt = tostring(val):lower():gsub(",", ""):gsub("%s+", "")
local num, suf = txt:match("^([%d%.]+)([kmb]?)$")
num = tonumber(num)
if not num then return 0 end
if suf == "k" then return num * 1000 end
if suf == "m" then return num * 1000000 end
if suf == "b" then return num * 1000000000 end
return num
end
local function getPlayerSpd()
local ls = player:FindFirstChild("leaderstats")
if not ls then return 0 end
local stat = ls:FindFirstChild("Speed")
if not stat then return 0 end
return parseSpd(stat.Value)
end
local function getGuardAreas()
local objs = workspace:FindFirstChild("__OBJECTS")
if not objs then return nil end
local areas = objs:FindFirstChild("Areas")
if not areas then return nil end
return areas:FindFirstChild("GuardAreas")
end
local function inArea(pos, area)
local cf, size = area:GetBoundingBox()
local lp = cf:PointToObjectSpace(pos)
return math.abs(lp.X) <= size.X/2 and math.abs(lp.Y) <= size.Y/2 and math.abs(lp.Z) <= size.Z/2
end
local function getAreaAt(pos)
local areas = getGuardAreas()
if not areas then return nil end
for _, area in ipairs(areas:GetChildren()) do
if area:IsA("Model") and inArea(pos, area) then return area end
end
return nil
end
local function getAreaReq(area)
if not area then return nil end
local sign = area:FindFirstChild("RequiredSpeedSign")
local main = sign and sign:FindFirstChild("Main")
local sg = main and main:FindFirstChild("SurfaceGui")
local req = sg and sg:FindFirstChild("Required")
local spd = req and req:FindFirstChild("Speed")
if not spd then return nil end
if spd:IsA("ValueBase") then return parseSpd(spd.Value) end
if spd:IsA("TextLabel") or spd:IsA("TextBox") then return parseSpd(spd.Text) end
return nil
end
local function getEggSize(egg)
if egg:IsA("Model") then
local s = egg:GetExtentsSize()
return s.X * s.Y * s.Z
end
if egg:IsA("BasePart") then
local s = egg.Size
return s.X * s.Y * s.Z
end
return 0
end
local function getBestEgg()
local folder = workspace:FindFirstChild("AreaEggSlotsClient")
if not folder then return nil end
local pSpd = getPlayerSpd()
local bestReq = -math.huge
local bestEggs = {}
for _, egg in ipairs(folder:GetChildren()) do
local ePos = getPos(egg)
if ePos then
local area = getAreaAt(ePos)
local req = getAreaReq(area) or 0
if pSpd >= req then
if req > bestReq then
bestReq = req
table.clear(bestEggs)
table.insert(bestEggs, egg)
elseif req == bestReq then
table.insert(bestEggs, egg)
end
end
end
end
if #bestEggs == 0 then return nil end
local biggest = nil
local biggestSize = -math.huge
for _, egg in ipairs(bestEggs) do
local s = getEggSize(egg)
if s > biggestSize then
biggestSize = s
biggest = egg
end
end
return biggest
end
local function getClosestPrompt(pos)
local closest = nil
local closestDist = math.huge
for _, obj in ipairs(workspace:GetDescendants()) do
if obj.Name == "SmartPromptPart" and obj:IsA("BasePart") then
local d = (obj.Position - pos).Magnitude
if d < closestDist then
closestDist = d
closest = obj
end
end
end
return closest
end
local function getPrompt(part)
if not part then return nil end
return part:FindFirstChildWhichIsA("ProximityPrompt", true)
end
local function raycastGround(origin, char)
local ignored = { char }
for _ = 1, 25 do
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = ignored
params.IgnoreWater = true
local result = workspace:Raycast(origin, Vector3.new(0, -RAY_DIST, 0), params)
if not result then return nil end
local hit = result.Instance
if hit == workspace.Terrain or (hit:IsA("BasePart") and hit.CanCollide) then
return result
end
table.insert(ignored, hit)
end
return nil
end
local function getGroundPos(hrp, reqPos, char)
local curGround = raycastGround(hrp.Position, char)
if not curGround then return nil end
local rootToFloor = math.clamp(hrp.Position.Y - curGround.Position.Y, 2, 6)
local origin = Vector3.new(reqPos.X, math.max(reqPos.Y, hrp.Position.Y) + RAY_START, reqPos.Z)
local destGround = raycastGround(origin, char)
if not destGround then return nil end
return destGround.Position + Vector3.new(0, rootToFloor + 0.05, 0)
end
local function getDur(dist)
local dur = 5 + (dist * 0.00343)
if dur < 0.5 then dur = 0.5 end
if dur > 40 then dur = 40 end
return dur
end
task.spawn(function()
while true do
task.wait(0.1)
if not enabled then continue end
local char, hrp = getRoot()
if not char or not hrp then continue end
local egg = getBestEgg()
if not egg then task.wait(1) continue end
local eggPos = getPos(egg)
if not eggPos then continue end
local stagePos = getGroundPos(hrp, RETURN, char)
if stagePos then
local t = TweenService:Create(hrp, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {CFrame = CFrame.new(stagePos)})
activeTween = t
t:Play()
t.Completed:Wait()
if activeTween == t then activeTween = nil end
end
if not enabled then continue end
local promptPart = getClosestPrompt(eggPos)
if not promptPart then continue end
local prompt = getPrompt(promptPart)
if not prompt then continue end
local eggGround = getGroundPos(hrp, eggPos, char)
if eggGround then
local dist = (hrp.Position - eggGround).Magnitude
local dur = getDur(dist)
local t = TweenService:Create(hrp, TweenInfo.new(dur, Enum.EasingStyle.Linear), {CFrame = CFrame.new(eggGround)})
activeTween = t
t:Play()
t.Completed:Wait()
if activeTween == t then activeTween = nil end
end
task.wait(0.2)
if enabled and prompt.Parent and typeof(fireproximityprompt) == "function" then
fireproximityprompt(prompt)
end
if not enabled then continue end
if player.Character ~= char or not hrp.Parent then continue end
local returnPos = getGroundPos(hrp, RETURN, char)
if returnPos then
local dist = (hrp.Position - returnPos).Magnitude
local dur = getDur(dist)
local t = TweenService:Create(hrp, TweenInfo.new(dur, Enum.EasingStyle.Linear), {CFrame = CFrame.new(returnPos)})
activeTween = t
t:Play()
t.Completed:Wait()
if activeTween == t then activeTween = nil end
task.wait(0.5)
end
end
end)
game:GetService("Players").LocalPlayer.PlayerScripts.Game.AntiAFK.Enabled = false
updBtn()