-- Robscript Team - Hyper Realistic Ragdoll (KO Farm)
-- Game: Hyper Realistic Ragdoll | placeId 101277003916102 | gameId 10773618503
-- Window: RightControl | Panic: End | API: getgenv().RobScriptHRR
----- Unload a previous copy -----
do
local existing = getgenv().RobScriptHRR
if type(existing) == "table" and type(existing.Destroy) == "function" then
pcall(existing.Destroy)
end
end
----- Services -----
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local LocalPlayer = Players.LocalPlayer
----- Library -----
local LIBRARY_URLS = {
"https://raw.githubusercontent.com/bobloscript/Robly_Airflow/main/Source.luau",
"https://raw.githubusercontent.com/PookiePepelsss/Airflow-UI/refs/heads/main/Source.luau",
}
local Airflow = nil
local fallbackLibrary = nil
for _, url in ipairs(LIBRARY_URLS) do
local ok, library = pcall(function()
return loadstring(game:HttpGet(url))()
end)
if ok and type(library) == "table" and type(library.CreateWindow) == "function" then
if not fallbackLibrary then
fallbackLibrary = library
end
if type(library.ThemePresets) == "table" then
Airflow = library
break
end
end
end
Airflow = Airflow or fallbackLibrary
if not Airflow then
error("[RobScript HRR] Airflow UI could not be loaded")
end
----- Theme -----
local THEME = {
Background = Color3.fromHex("#0A0A0C"),
Surface = Color3.fromHex("#141418"),
Surface2 = Color3.fromHex("#1A1A20"),
Surface3 = Color3.fromHex("#2A2A33"),
Stroke = Color3.fromHex("#26262E"),
StrokeHover = Color3.fromHex("#3C3C49"),
Accent = Color3.fromHex("#FF3B7F"),
AccentDark = Color3.fromHex("#1A0710"),
Text = Color3.fromHex("#F5F5F7"),
Muted = Color3.fromHex("#8D8D99"),
}
local ThemeValue = THEME
do
local merged = {}
for key, value in pairs(Airflow.Theme or {}) do
merged[key] = value
end
for key, value in pairs(THEME) do
merged[key] = value
end
if type(Airflow.AddTheme) == "function" and type(Airflow.SetTheme) == "function" then
local ok = pcall(function()
Airflow:AddTheme("Robscript", merged)
Airflow:SetTheme("Robscript")
end)
if ok then
ThemeValue = "Robscript"
end
elseif type(Airflow.ThemePresets) == "table" then
Airflow.ThemePresets.Robscript = merged
pcall(function()
Airflow:SetDefaultTheme("Robscript")
end)
end
end
----- Constants -----
local PLATFORM_NAME = "HRR_KO_Platform"
local AIM_PART = "Head"
local FALLBACK_AIM_PART = "UpperTorso"
-- 25 studs keeps the whole arena in sight while the shot angle stays flat enough
-- to land on the head: measured in the live client, 13 shots gave 13 knock-outs.
local DEFAULT_HEIGHT = 25
local DEFAULT_RANGE = 260
local DEFAULT_DELAY = 0.25
-- Clearing the whole arena in seconds trips the anticheat and the client crashes,
-- so every knock-out is followed by a configurable pause before the next body is
-- searched for. The jitter keeps the rhythm from looking mechanical.
local DEFAULT_SEARCH_COOLDOWN = 1.6
local DEFAULT_JITTER = 0.2
local MAX_SHOTS_PER_TARGET = 5
local KEY_OPTIONS = {
"None", "X", "Z", "C", "V", "B", "N", "M",
"G", "H", "J", "K", "L", "Q", "E", "R", "F", "T",
"F1", "F2", "F3", "F4", "F5",
"LeftShift", "RightShift", "Tab", "CapsLock", "Delete", "End",
}
----- Flags -----
local flagCache = {}
local function resetFlagCache()
flagCache = {}
end
local function getFlag(name)
local cached = flagCache[name]
if cached ~= nil then
return cached ~= false and cached or nil
end
local container = Airflow.Flags
local entry = type(container) == "table" and container[name] or nil
if type(entry) == "table" then
flagCache[name] = entry
return entry
end
flagCache[name] = false
return nil
end
local function flag(name, fallback)
local entry = getFlag(name)
if not entry then
return fallback
end
local ok, value = pcall(function()
return entry:Get()
end)
if ok and value ~= nil then
return value
end
return fallback
end
local function setFlag(name, value)
local entry = getFlag(name)
if not entry then
return false
end
return (pcall(function()
entry:Set(value)
end))
end
----- State -----
local running = true
local stats = {
downs = 0,
shots = 0,
targets = 0,
kOs = 0,
cooldown = DEFAULT_SEARCH_COOLDOWN,
mode = "idle",
}
local downedSet = {}
local shotCounters = {}
local savedWalkSpeed = nil
local savedJumpPower = nil
local platformTopY = nil
-- Game screens that exist before the hub window is built; only those can eat the
-- click, so the hub itself never pauses the farm.
local gameScreens = {}
----- Game access -----
local function dummyFolder()
return workspace:FindFirstChild("Dummies")
end
local function currentCharacter()
local character = LocalPlayer.Character
if not character or not character.Parent then
return nil
end
return character
end
local function characterHead(character)
local head = character and character:FindFirstChild("Head")
if head and head:IsA("BasePart") then
return head
end
local root = character and character:FindFirstChild("HumanoidRootPart")
if root and root:IsA("BasePart") then
return root
end
return nil
end
local function humanoidOf(character)
return character and character:FindFirstChildOfClass("Humanoid")
end
local function knockedOut(dummy)
local humanoid = dummy:FindFirstChildOfClass("Humanoid")
if not humanoid then
return true
end
if humanoid.Health <= 0 then
return true
end
local state = humanoid:GetState()
return state == Enum.HumanoidStateType.FallingDown or state == Enum.HumanoidStateType.Dead
end
local function aimPartOf(dummy)
local part = dummy:FindFirstChild(AIM_PART)
if part and part:IsA("BasePart") then
return part
end
part = dummy:FindFirstChild(FALLBACK_AIM_PART)
if part and part:IsA("BasePart") then
return part
end
return nil
end
local function knockoutCount()
local leaderstats = LocalPlayer:FindFirstChild("leaderstats")
local kOs = leaderstats and leaderstats:FindFirstChild("KOs")
if kOs and kOs:IsA("ValueBase") then
return tonumber(kOs.Value) or 0
end
return 0
end
----- Targeting -----
local function raycastParams(character, platform)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
local ignore = {}
if character then
table.insert(ignore, character)
end
local camera = workspace.CurrentCamera
if camera then
table.insert(ignore, camera)
end
if platform then
table.insert(ignore, platform)
end
params.FilterDescendantsInstances = ignore
return params
end
local function hasLineOfSight(eye, targetPart, dummy, params)
local delta = targetPart.Position - eye
local distance = delta.Magnitude
if distance < 0.5 then
return false
end
local result = workspace:Raycast(eye, delta, params)
if not result then
return true
end
if result.Instance:IsDescendantOf(dummy) then
return true
end
return result.Distance >= distance - 0.8
end
local function collectTargets(eye, maxRange, params)
local folder = dummyFolder()
if not folder then
return {}
end
local list = {}
for _, dummy in ipairs(folder:GetChildren()) do
if dummy:IsA("Model") and not knockedOut(dummy) then
local part = aimPartOf(dummy)
if part then
local distance = (part.Position - eye).Magnitude
if distance > 3 and distance <= maxRange and hasLineOfSight(eye, part, dummy, params) then
list[#list + 1] = { dummy = dummy, part = part, distance = distance }
end
end
end
end
table.sort(list, function(a, b)
return a.distance < b.distance
end)
return list
end
local function trackDowns()
local folder = dummyFolder()
if not folder then
return
end
for _, dummy in ipairs(folder:GetChildren()) do
if dummy:IsA("Model") and not downedSet[dummy] and knockedOut(dummy) then
downedSet[dummy] = true
stats.downs = stats.downs + 1
end
end
for dummy in pairs(shotCounters) do
if not dummy.Parent then
shotCounters[dummy] = nil
end
end
end
----- Platform -----
local function arenaFloorY()
local folder = dummyFolder()
if not folder then
return nil
end
local total, count = 0, 0
for _, dummy in ipairs(folder:GetChildren()) do
local root = dummy:FindFirstChild("HumanoidRootPart")
if root and root:IsA("BasePart") then
total = total + root.Position.Y
count = count + 1
end
end
if count == 0 then
return nil
end
return total / count
end
local function arenaCenter()
local folder = dummyFolder()
if not folder then
return nil
end
local sum = Vector3.zero
local count = 0
for _, dummy in ipairs(folder:GetChildren()) do
local root = dummy:FindFirstChild("HumanoidRootPart")
if root and root:IsA("BasePart") then
sum = sum + root.Position
count = count + 1
end
end
if count == 0 then
return nil
end
return sum / count
end
local function buildPlatform()
local existing = workspace:FindFirstChild(PLATFORM_NAME)
if existing then
platformTopY = existing.Position.Y + existing.Size.Y * 0.5
return existing
end
local center = arenaCenter()
local floorY = arenaFloorY()
local character = currentCharacter()
local root = character and character:FindFirstChild("HumanoidRootPart")
if floorY == nil then
floorY = root and root.Position.Y or 0
end
if center == nil then
center = root and root.Position or Vector3.zero
end
local height = flag("PlatformHeight", DEFAULT_HEIGHT)
local part = Instance.new("Part")
part.Name = PLATFORM_NAME
part.Anchored = true
part.CanCollide = true
part.CanQuery = false
part.CanTouch = false
part.Material = Enum.Material.Metal
part.Color = Color3.fromRGB(38, 38, 46)
part.Transparency = 0.45
part.Size = Vector3.new(14, 1, 14)
part.Position = Vector3.new(center.X, floorY + height, center.Z)
part.TopSurface = Enum.SurfaceType.Smooth
part.BottomSurface = Enum.SurfaceType.Smooth
part.Parent = workspace
platformTopY = part.Position.Y + part.Size.Y * 0.5
return part
end
local function removePlatform()
local existing = workspace:FindFirstChild(PLATFORM_NAME)
if existing then
existing:Destroy()
end
platformTopY = nil
end
local function standOnPlatform()
local part = buildPlatform()
local character = currentCharacter()
local humanoid = humanoidOf(character)
local root = character and character:FindFirstChild("HumanoidRootPart")
if not part or not character or not root or not humanoid then
return false
end
if humanoid.Health <= 0 then
return false
end
local target = Vector3.new(part.Position.X, part.Position.Y + part.Size.Y * 0.5 + 3.2, part.Position.Z)
local flatDistance = (Vector3.new(root.Position.X, 0, root.Position.Z) - Vector3.new(target.X, 0, target.Z)).Magnitude
local verticalDistance = math.abs(root.Position.Y - target.Y)
if flatDistance > 6 or verticalDistance > 12 then
pcall(function()
character:PivotTo(CFrame.new(target))
end)
return true
end
return false
end
----- Input -----
local function viewportCenter()
local camera = workspace.CurrentCamera
local size = camera and camera.ViewportSize or Vector2.new(1280, 720)
return math.floor(size.X * 0.5), math.floor(size.Y * 0.5)
end
-- A click in the middle of the screen must never land on a menu button, so the
-- shot is held back while any solid interface element sits under the crosshair.
local function interfaceBlocked()
local x, y = viewportCenter()
local playerGui = LocalPlayer:FindFirstChild("PlayerGui")
if not playerGui then
return false
end
local ok, objects = pcall(function()
return playerGui:GetGuiObjectsAtPosition(x, y)
end)
if not ok or type(objects) ~= "table" then
return false
end
for _, object in ipairs(objects) do
if object:IsA("GuiButton") then
return true
end
if object:IsA("GuiObject") and object.Visible then
local screenGui = object:FindFirstAncestorWhichIsA("ScreenGui")
if screenGui and gameScreens[screenGui] then
local background = object:IsA("Frame") and object.BackgroundTransparency or 1
if background < 0.9 then
return true
end
end
end
end
return false
end
local function fireOnce()
local x, y = viewportCenter()
local ok = pcall(function()
VirtualInputManager:SendMouseButtonEvent(x, y, 0, true, game, 0)
end)
task.wait(0.03)
pcall(function()
VirtualInputManager:SendMouseButtonEvent(x, y, 0, false, game, 0)
end)
if not ok then
local environment = getgenv()
if type(environment.mouse1click) == "function" then
pcall(function()
environment.mouse1click()
end)
end
end
stats.shots = stats.shots + 1
end
local function aimAt(character, position)
local camera = workspace.CurrentCamera
local eye = characterHead(character)
if not camera or not eye then
return false
end
if camera.CameraType ~= Enum.CameraType.Scriptable then
camera.CameraType = Enum.CameraType.Scriptable
end
camera.CFrame = CFrame.lookAt(eye.Position, position)
return true
end
local function equipPistol(character, humanoid)
local pistol = character:FindFirstChild("Pistol")
if pistol then
return true
end
local backpack = LocalPlayer:FindFirstChild("Backpack")
pistol = backpack and backpack:FindFirstChild("Pistol")
if not pistol then
return false
end
pcall(function()
humanoid:EquipTool(pistol)
end)
return true
end
local function freezeCharacter(humanoid)
if not humanoid then
return
end
if savedWalkSpeed == nil then
savedWalkSpeed = humanoid.WalkSpeed
savedJumpPower = humanoid.JumpPower
end
pcall(function()
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
humanoid.JumpHeight = 0
end)
end
local function releaseCharacter(humanoid)
if not humanoid then
return
end
pcall(function()
humanoid.WalkSpeed = savedWalkSpeed or 16
humanoid.JumpPower = savedJumpPower or 50
humanoid.JumpHeight = 7.2
end)
savedWalkSpeed = nil
savedJumpPower = nil
end
local function restoreCamera()
local camera = workspace.CurrentCamera
local character = currentCharacter()
local humanoid = humanoidOf(character)
if not camera then
return
end
pcall(function()
camera.CameraType = Enum.CameraType.Custom
if humanoid then
camera.CameraSubject = humanoid
end
end)
end
----- Farm cycle -----
local function keyNameToEnum(name)
if type(name) ~= "string" or name == "" or name == "None" then
return nil
end
local ok, keyCode = pcall(function()
return Enum.KeyCode[name]
end)
if ok then
return keyCode
end
return nil
end
-- Delay before the next dummy is searched for. A fixed rhythm looks mechanical
-- and the game's anticheat reacts to it, so the pause is jittered by default.
local function nextSearchDelay()
local base = tonumber(flag("SearchCooldown", DEFAULT_SEARCH_COOLDOWN)) or DEFAULT_SEARCH_COOLDOWN
if base <= 0 then
return 0
end
if flag("CooldownJitter", true) then
local spread = tonumber(flag("JitterAmount", DEFAULT_JITTER)) or DEFAULT_JITTER
return math.max(0.1, base * (1 - spread + math.random() * spread * 2))
end
return base
end
local function farmStep()
local character = currentCharacter()
local humanoid = humanoidOf(character)
local eye = characterHead(character)
if not character or not humanoid or not eye then
stats.mode = "no character"
return
end
if humanoid.Health <= 0 then
stats.mode = "respawn"
return
end
if flag("KeepPlatform", true) then
freezeCharacter(humanoid)
standOnPlatform()
end
if not equipPistol(character, humanoid) then
stats.mode = "no pistol"
return
end
local platform = workspace:FindFirstChild(PLATFORM_NAME)
local params = raycastParams(character, platform)
local maxRange = flag("FarmRange", DEFAULT_RANGE)
local targets = collectTargets(eye.Position, maxRange, params)
stats.targets = #targets
stats.kOs = knockoutCount()
if #targets == 0 then
local pause = nextSearchDelay()
stats.mode = string.format("no targets, %.1f s", pause)
stats.cooldown = pause
task.wait(pause)
return
end
local target = targets[1]
local dummy = target.dummy
if (shotCounters[dummy] or 0) >= MAX_SHOTS_PER_TARGET then
-- This body is already unreachable; try the next one before giving up.
local alternative = nil
for index = 2, math.min(#targets, 6) do
local candidate = targets[index]
if (shotCounters[candidate.dummy] or 0) < MAX_SHOTS_PER_TARGET then
alternative = candidate
break
end
end
if not alternative then
shotCounters = {}
stats.mode = "resetting aim"
return
end
target = alternative
dummy = target.dummy
end
if interfaceBlocked() then
stats.mode = "interface open"
return
end
aimAt(character, target.part.Position)
fireOnce()
shotCounters[dummy] = (shotCounters[dummy] or 0) + 1
local down = knockedOut(dummy)
if down then
shotCounters[dummy] = nil
trackDowns()
local pause = nextSearchDelay()
stats.mode = string.format("cooldown %.1f s", pause)
stats.cooldown = pause
task.wait(pause)
else
stats.mode = string.format("shooting %.0f", target.distance)
task.wait(flag("FireDelay", DEFAULT_DELAY))
end
end
----- Interface -----
do
local playerGui = LocalPlayer:FindFirstChild("PlayerGui")
if playerGui then
for _, gui in ipairs(playerGui:GetChildren()) do
if gui:IsA("ScreenGui") then
gameScreens[gui] = true
end
end
end
end
local Window = Airflow:CreateWindow({
Name = "Robscript Team",
LoadingSubtitle = "hyper realistic ragdoll - ko farm",
ToggleUIKeybind = "RightControl",
Size = UDim2.fromOffset(780, 540),
Theme = ThemeValue,
Density = "Compact",
Backdrop = { Weather = "Fireflies", Tint = 0.35 },
ConfigurationSaving = { Enabled = true, FolderName = "RobScriptHRR" },
Home = {
Title = "Robscript Team",
Welcome = "Welcome back,",
Tier = "KO FARM 1.0",
Stats = { "Players", "Session", "FPS", "Ping", "Game", "Executor" },
},
})
local FarmTab = Window:CreateTab({ Name = "Farm", Icon = "target" })
local FarmBox = FarmTab:CreateGroupbox({ Name = "Automatic", Side = "Left" })
local AimBox = FarmTab:CreateGroupbox({ Name = "Aim", Side = "Right" })
FarmBox:CreateToggle({
Name = "KO Farm",
Desc = "Knock out dummies with the pistol one after another",
Flag = "KOFarm",
CurrentValue = false,
})
FarmBox:CreateToggle({
Name = "Air platform",
Desc = "Lift the player above the arena and shoot down from there",
Flag = "KeepPlatform",
CurrentValue = true,
DependsOn = "KOFarm",
})
FarmBox:CreateSlider({
Name = "Platform height",
Range = { 10, 120 },
Increment = 5,
Suffix = " studs",
CurrentValue = DEFAULT_HEIGHT,
Flag = "PlatformHeight",
DependsOn = "KOFarm",
})
FarmBox:CreateDivider()
FarmBox:CreateButton({
Name = "Rebuild platform",
Desc = "Move the platform over the current arena",
Callback = function()
removePlatform()
buildPlatform()
Window:Notify({ Title = "Platform", Content = "Platform rebuilt over the arena", Type = "Info" })
end,
})
FarmBox:CreateButton({
Name = "Remove platform",
Desc = "Delete the platform and let the player fall back",
Callback = function()
removePlatform()
Window:Notify({ Title = "Platform", Content = "Platform removed", Type = "Info" })
end,
})
FarmBox:CreateStatus({
Name = "State",
Style = "Row",
UpdateRate = 0.4,
Update = function()
return string.format("%s | %d targets", stats.mode, stats.targets)
end,
})
AimBox:CreateSlider({
Name = "Reach",
Range = { 60, 600 },
Increment = 20,
Suffix = " studs",
CurrentValue = DEFAULT_RANGE,
Flag = "FarmRange",
DependsOn = "KOFarm",
})
AimBox:CreateSlider({
Name = "Fire delay",
Range = { 0.1, 1 },
Increment = 0.02,
Suffix = " s",
CurrentValue = DEFAULT_DELAY,
Flag = "FireDelay",
DependsOn = "KOFarm",
})
AimBox:CreateSlider({
Name = "Search cooldown",
Desc = "Pause after every knock-out before the next dummy is searched for",
Range = { 0, 8 },
Increment = 0.1,
Suffix = " s",
CurrentValue = DEFAULT_SEARCH_COOLDOWN,
Flag = "SearchCooldown",
DependsOn = "KOFarm",
})
AimBox:CreateToggle({
Name = "Cooldown jitter",
Desc = "Vary the pause so the rhythm is not perfectly even",
Flag = "CooldownJitter",
CurrentValue = true,
DependsOn = "KOFarm",
})
AimBox:CreateSlider({
Name = "Jitter",
Range = { 0, 0.5 },
Increment = 0.05,
Suffix = " x",
CurrentValue = DEFAULT_JITTER,
Flag = "JitterAmount",
DependsOn = "CooldownJitter",
})
AimBox:CreateDivider()
AimBox:CreateStatus({
Name = "Downs",
Style = "Row",
UpdateRate = 0.5,
Update = function()
return string.format("%d knocked out this session", stats.downs)
end,
})
AimBox:CreateStatus({
Name = "KOs",
Style = "Row",
UpdateRate = 0.5,
Update = function()
return string.format("%d on the account", stats.kOs)
end,
})
AimBox:CreateStatus({
Name = "Shots",
Style = "Row",
UpdateRate = 0.5,
Update = function()
return string.format("%d fired", stats.shots)
end,
})
AimBox:CreateStatus({
Name = "Cooldown",
Style = "Row",
UpdateRate = 0.5,
Update = function()
return string.format("%.1f s until next target", stats.cooldown)
end,
})
local SettingsTab = Window:CreateTab({ Name = "Settings", Icon = "settings" })
local InfoBox = SettingsTab:CreateGroupbox({ Name = "Session", Side = "Left" })
local ManageBox = SettingsTab:CreateGroupbox({ Name = "Control", Side = "Right" })
InfoBox:CreateStatus({
Name = "Game",
Style = "Row",
UpdateRate = 2,
Update = function()
return string.format("%s %d", game.Name, game.PlaceId)
end,
})
InfoBox:CreateStatus({
Name = "Dummies",
Style = "Row",
UpdateRate = 1,
Update = function()
local folder = dummyFolder()
local total = 0
local fresh = 0
if folder then
for _, dummy in ipairs(folder:GetChildren()) do
total = total + 1
if not knockedOut(dummy) then
fresh = fresh + 1
end
end
end
return string.format("%d awake of %d", fresh, total)
end,
})
ManageBox:CreateDropdown({
Name = "Farm key",
Desc = "Toggles the KO farm on and off",
Options = KEY_OPTIONS,
CurrentOption = "X",
Flag = "FarmKey",
})
ManageBox:CreateDropdown({
Name = "Panic key",
Desc = "Stops the farm and gives control back",
Options = KEY_OPTIONS,
CurrentOption = "End",
Flag = "PanicKey",
})
ManageBox:CreateDivider()
ManageBox:CreateButton({
Name = "Reset counters",
Desc = "Clear the session numbers",
Callback = function()
stats.downs = 0
stats.shots = 0
downedSet = {}
shotCounters = {}
end,
})
ManageBox:CreateButton({
Name = "Stop farm",
Desc = "Turn the farm off and return control",
Callback = function()
setFlag("KOFarm", false)
end,
})
ManageBox:CreateButton({
Name = "Unload",
Desc = "Close the interface and stop everything",
Style = "Primary",
Callback = function()
local api = getgenv().RobScriptHRR
if type(api) == "table" and type(api.Destroy) == "function" then
api.Destroy()
end
end,
})
----- Runtime -----
resetFlagCache()
stats.kOs = knockoutCount()
local loopThread = task.spawn(function()
while running do
if flag("KOFarm", false) then
local ok, err = pcall(farmStep)
if not ok then
stats.mode = "error"
warn("[RobScript HRR] farm step failed: " .. tostring(err))
end
else
stats.mode = "idle"
local character = currentCharacter()
local humanoid = humanoidOf(character)
if humanoid and savedWalkSpeed ~= nil then
releaseCharacter(humanoid)
end
if workspace.CurrentCamera and workspace.CurrentCamera.CameraType == Enum.CameraType.Scriptable then
restoreCamera()
end
task.wait(0.4)
end
end
end)
local inputConnection = UserInputService.InputBegan:Connect(function(input, processed)
if not running then
return
end
local farmKey = keyNameToEnum(flag("FarmKey", "X"))
local panicKey = keyNameToEnum(flag("PanicKey", "End"))
-- The panic key is honoured even while a text field has focus; the farm key is
-- not, so typing in chat can never start the farm.
if panicKey and input.KeyCode == panicKey then
pcall(function()
setFlag("KOFarm", false)
setFlag("KeepPlatform", false)
local character = currentCharacter()
releaseCharacter(humanoidOf(character))
restoreCamera()
end)
stats.mode = "idle"
Window:Notify({ Title = "Panic", Content = "Farm stopped, control returned", Type = "Warning" })
return
end
if processed then
return
end
if farmKey and input.KeyCode == farmKey then
local enabled = not flag("KOFarm", false)
setFlag("KOFarm", enabled)
Window:Notify({
Title = "KO Farm",
Content = enabled and "Farm started" or "Farm stopped",
Type = enabled and "Success" or "Info",
})
end
end)
----- Teardown -----
local function destroy()
if not running then
return
end
running = false
pcall(function()
inputConnection:Disconnect()
end)
pcall(function()
task.cancel(loopThread)
end)
local character = currentCharacter()
releaseCharacter(humanoidOf(character))
restoreCamera()
pcall(function()
removePlatform()
end)
pcall(function()
Window:Destroy()
end)
Airflow = nil
if getgenv().RobScriptHRR then
getgenv().RobScriptHRR = nil
end
end
----- Public interface -----
getgenv().RobScriptHRR = {
Version = "1.0",
Set = function(name, value)
return setFlag(name, value)
end,
Get = function(name, fallback)
return flag(name, fallback)
end,
GetStats = function()
return {
downs = stats.downs,
shots = stats.shots,
kOs = stats.kOs,
targets = stats.targets,
mode = stats.mode,
}
end,
Platform = {
Build = buildPlatform,
Remove = removePlatform,
Stand = standOnPlatform,
},
Destroy = destroy,
}
----- Boot -----
pcall(function()
Window:LoadAutoload()
end)
Window:Notify({ Title = "Robscript Team", Content = "KO farm is ready", Type = "Success" })
return getgenv().RobScriptHRR