local Fluent = loadstring(game:HttpGet("https://github.com/dawid-scripts/Fluent/releases/latest/download/main.lua"))() local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local rootPart = character:WaitForChild("HumanoidRootPart") local isRunning = false local currentTargetIndex = 1 local targetPlayers = {} local connection local lastTargetSwitch = 0 local TARGET_SWITCH_INTERVAL = 0.4 local UNDERGROUND_DEPTH = 6 local autoClickEnabled = false local lastClickTime = 0 local CLICK_DELAY = 1 local VirtualUser = game:GetService("VirtualUser") local DEFAULT_POSITION = Vector3.new(0, 12345, 0) local Window = Fluent:CreateWindow({ Title = "linhmc's auto farm|KAT X", SubTitle = "by linhmc_new", TabWidth = 160, Size = UDim2.fromOffset(580, 460), Acrylic = true, Theme = "Dark", MinimizeKey = Enum.KeyCode.LeftControl }) local Tabs = { Main = Window:AddTab({ Title = "Main", Icon = "sword" }), Settings = Window:AddTab({ Title = "Settings", Icon = "settings" }) } local function hasForceField(targetPlayer) if not targetPlayer or not targetPlayer.Character then return true end local forceField = targetPlayer.Character:FindFirstChildOfClass("ForceField") return forceField ~= nil end local function equipKnife() local backpack = player:FindFirstChild("Backpack") if not backpack then return false end local knife = backpack:FindFirstChild("Knife") if knife then humanoid:EquipTool(knife) return true end for _, obj in pairs(workspace:GetDescendants()) do if obj.Name == "Knife" and obj:IsA("Tool") and not obj.Parent:IsA("Player") then if obj:FindFirstChild("Handle") then rootPart.CFrame = obj.Handle.CFrame wait(0.1) obj.Parent = backpack humanoid:EquipTool(obj) return true end end end return false end local function hasKnifeEquipped() local tool = character:FindFirstChildOfClass("Tool") return tool and tool.Name == "Knife" end local function autoClick() if not autoClickEnabled then return end local currentTime = tick() if currentTime - lastClickTime >= CLICK_DELAY then VirtualUser:ClickButton1(Vector2.new(0, 0)) lastClickTime = currentTime end end local function updateTargetPlayers() targetPlayers = {} for _, targetPlayer in pairs(Players:GetPlayers()) do if targetPlayer ~= player and targetPlayer.Character and targetPlayer.Character:FindFirstChild("HumanoidRootPart") and not hasForceField(targetPlayer) then table.insert(targetPlayers, targetPlayer) end end end local function getCurrentTarget() updateTargetPlayers() if #targetPlayers == 0 then return nil end if currentTargetIndex > #targetPlayers then currentTargetIndex = 1 end return targetPlayers[currentTargetIndex] end local function moveToDefaultPosition() local lyingCFrame = CFrame.new(DEFAULT_POSITION) * CFrame.Angles(math.rad(90), 0, 0) rootPart.CFrame = lyingCFrame end local function followTargetLyingDown() local target = getCurrentTarget() if not target or not target.Character or not target.Character:FindFirstChild("HumanoidRootPart") then moveToDefaultPosition() return end if hasForceField(target) then currentTargetIndex = currentTargetIndex + 1 moveToDefaultPosition() return end local targetRoot = target.Character.HumanoidRootPart local targetPos = targetRoot.Position local myPosition = Vector3.new( targetPos.X, targetPos.Y - UNDERGROUND_DEPTH, targetPos.Z ) local lyingCFrame = CFrame.new(myPosition) * CFrame.Angles(math.rad(90), 0, 0) rootPart.CFrame = lyingCFrame end local function disableMovement() if humanoid then humanoid.PlatformStand = true humanoid.WalkSpeed = 0 humanoid.JumpPower = 0 end end local function switchTarget() local currentTime = tick() if currentTime - lastTargetSwitch >= TARGET_SWITCH_INTERVAL then currentTargetIndex = currentTargetIndex + 1 if currentTargetIndex > #targetPlayers then currentTargetIndex = 1 updateTargetPlayers() end lastTargetSwitch = currentTime end end local function mainLoop() if not hasKnifeEquipped() then equipKnife() end disableMovement() switchTarget() followTargetLyingDown() autoClick() end local function toggleScript() if isRunning then isRunning = false if connection then connection:Disconnect() connection = nil end if humanoid then humanoid.PlatformStand = false humanoid.WalkSpeed = 16 humanoid.JumpPower = 50 end local currentPos = rootPart.Position rootPart.CFrame = CFrame.new(currentPos.X, currentPos.Y + UNDERGROUND_DEPTH + 10, currentPos.Z) else isRunning = true currentTargetIndex = 1 lastTargetSwitch = 0 lastClickTime = 0 updateTargetPlayers() connection = RunService.Heartbeat:Connect(function() if isRunning then mainLoop() end end) end end player.CharacterAdded:Connect(function(newCharacter) character = newCharacter humanoid = character:WaitForChild("Humanoid") rootPart = character:WaitForChild("HumanoidRootPart") end) local MainToggle = Tabs.Main:AddToggle("MainToggle", { Title = "Auto Farm", Default = false, Callback = function(Value) if Value ~= isRunning then toggleScript() end end }) local AutoClickToggle = Tabs.Main:AddToggle("AutoClickToggle", { Title = "Auto Click (recommend for auto farm)", Default = false, Callback = function(Value) autoClickEnabled = Value end }) local NextTargetButton = Tabs.Main:AddButton({ Title = "Next Target", Description = "Switch to next target", Callback = function() if isRunning then currentTargetIndex = currentTargetIndex + 1 lastTargetSwitch = tick() end end }) local ResetButton = Tabs.Main:AddButton({ Title = "Reset", Description = "Reset target list (for some bad executor)", Callback = function() if isRunning then currentTargetIndex = 1 lastTargetSwitch = 0 updateTargetPlayers() end end }) local DefaultPosButton = Tabs.Main:AddButton({ Title = "Go to Default Position", Description = "Move to (0, 12345, 0)", Callback = function() if isRunning then moveToDefaultPosition() end end }) local DepthSlider = Tabs.Settings:AddSlider("DepthSlider", { Title = "Underground Depth", Description = "How deep under target", Default = 3, Min = 1, Max = 5, Rounding = 1, Callback = function(Value) UNDERGROUND_DEPTH = Value end }) local ClickDelaySlider = Tabs.Settings:AddSlider("ClickDelaySlider", { Title = "Click Delay", Description = "Delay between clicks (seconds)", Default = 0.1, Min = 0.1, Max = 5, Rounding = 1, Callback = function(Value) CLICK_DELAY = Value end }) local SwitchIntervalSlider = Tabs.Settings:AddSlider("SwitchIntervalSlider", { Title = "Target Switch Delay", Description = "Time between target switches", Default = 0.4, Min = 0.1, Max = 2, Rounding = 1, Callback = function(Value) TARGET_SWITCH_INTERVAL = Value end }) Window:SelectTab(1)