2026 best Keyless AutoFarm script in BABFT
Key Required

2026 best Keyless AutoFarm script in BABFT

Build A Boat For TreasureKJJJpyprKJJJpypr 598 views 2K executesUpdated Jul 18, 2026
Unrated
00
Lua Script•615 lines (15645 chars)
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local VirtualInputManager = game:GetService("VirtualInputManager")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local FIRST_CYCLE_INTERVAL = 0.3
local DEFAULT_INTERVAL = 1.5

local points = {
	Vector3.new(-60, 120, 2125),--1
	Vector3.new(-60, 120, 2895),--2
	Vector3.new(-60, 120, 3665),--3
	Vector3.new(-60, 120, 4425),--4
	Vector3.new(-60, 120, 5195),--5
	Vector3.new(-60, 120, 5965),--6
	Vector3.new(-60, 120, 6745),--7
	Vector3.new(-60, 120, 7515),--8
	Vector3.new(-60, 120, 8285),--9
	Vector3.new(-60, -360, 9492),--10
}

local enabled = false
local interval = DEFAULT_INTERVAL
local xOffset = 0
local yOffset = 0

local routeToken = 0
local savedHumanoidState = {}
local hoverPosition = nil
local lockActive = false

local antiAFKEnabled = false
local antiAFKThread = nil

local gui = Instance.new("ScreenGui")
gui.Name = "Gui"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.DisplayOrder = 999
gui.Parent = playerGui

local main = Instance.new("Frame")
main.Name = "Main"
main.Size = UDim2.new(0, 350, 0, 290) 
main.Position = UDim2.new(0, 20, 0, 80)
main.BackgroundColor3 = Color3.fromRGB(28, 28, 32)
main.BorderSizePixel = 0
main.Parent = gui

local mainCorner = Instance.new("UICorner")
mainCorner.CornerRadius = UDim.new(0, 10)
mainCorner.Parent = main

local mainStroke = Instance.new("UIStroke")
mainStroke.Thickness = 1
mainStroke.Color = Color3.fromRGB(70, 70, 80)
mainStroke.Parent = main

local topBar = Instance.new("Frame")
topBar.Name = "TopBar"
topBar.Size = UDim2.new(1, 0, 0, 28)
topBar.BackgroundColor3 = Color3.fromRGB(38, 38, 44)
topBar.BorderSizePixel = 0
topBar.Parent = main

local topBarCorner = Instance.new("UICorner")
topBarCorner.CornerRadius = UDim.new(0, 10)
topBarCorner.Parent = topBar

local topCover = Instance.new("Frame")
topCover.Size = UDim2.new(1, 0, 0, 10)
topCover.Position = UDim2.new(0, 0, 1, -10)
topCover.BackgroundColor3 = Color3.fromRGB(38, 38, 44)
topCover.BorderSizePixel = 0
topCover.Parent = topBar

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -90, 1, 0)
title.Position = UDim2.new(0, 12, 0, 0)
title.BackgroundTransparency = 1
title.Text = "BABFT AutoFarm"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Font = Enum.Font.GothamSemibold
title.TextSize = 16
title.TextXAlignment = Enum.TextXAlignment.Left
title.Parent = topBar

local toggleButton = Instance.new("TextButton")
toggleButton.Size = UDim2.new(0, 60, 0, 20)
toggleButton.Position = UDim2.new(1, -70, 0, 4)
toggleButton.BackgroundColor3 = Color3.fromRGB(90, 90, 96)
toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleButton.Font = Enum.Font.GothamBold
toggleButton.TextSize = 14
toggleButton.Text = "OFF"
toggleButton.BorderSizePixel = 0
toggleButton.Parent = topBar

local toggleCorner = Instance.new("UICorner")
toggleCorner.CornerRadius = UDim.new(0, 6)
toggleCorner.Parent = toggleButton

local content = Instance.new("Frame")
content.Name = "Content"
content.Size = UDim2.new(1, -20, 1, -38)
content.Position = UDim2.new(0, 10, 0, 34)
content.BackgroundTransparency = 1
content.Parent = main

local listLayout = Instance.new("UIListLayout")
listLayout.Padding = UDim.new(0, 10)
listLayout.FillDirection = Enum.FillDirection.Vertical
listLayout.SortOrder = Enum.SortOrder.LayoutOrder
listLayout.Parent = content

local function getCharacter()
	local character = player.Character
	if character and character.Parent then
		return character
	end
	return nil
end

local function getRootAndHumanoid(character)
	if not character then
		return nil, nil
	end

	local humanoid = character:FindFirstChildOfClass("Humanoid")
	local root = character:FindFirstChild("HumanoidRootPart")
	return root, humanoid
end

local function saveHumanoidState(humanoid)
	if not humanoid or savedHumanoidState[humanoid] then
		return
	end

	savedHumanoidState[humanoid] = {
		WalkSpeed = humanoid.WalkSpeed,
		JumpPower = humanoid.JumpPower,
		JumpHeight = humanoid.JumpHeight,
		UseJumpPower = humanoid.UseJumpPower,
		AutoRotate = humanoid.AutoRotate,
		PlatformStand = humanoid.PlatformStand,
	}
end

local function restoreHumanoidState(humanoid)
	if not humanoid then
		return
	end

	local saved = savedHumanoidState[humanoid]
	if not saved then
		return
	end

	humanoid.WalkSpeed = saved.WalkSpeed
	humanoid.JumpPower = saved.JumpPower
	humanoid.JumpHeight = saved.JumpHeight
	humanoid.UseJumpPower = saved.UseJumpPower
	humanoid.AutoRotate = saved.AutoRotate
	humanoid.PlatformStand = saved.PlatformStand

	savedHumanoidState[humanoid] = nil
end

local function setLock(character, shouldLock)
	local root, humanoid = getRootAndHumanoid(character)
	if not root or not humanoid then
		return
	end

	if shouldLock then
		saveHumanoidState(humanoid)

		humanoid.WalkSpeed = 0
		humanoid.JumpPower = 0
		humanoid.JumpHeight = 0
		humanoid.AutoRotate = false
		humanoid.PlatformStand = true
		humanoid:ChangeState(Enum.HumanoidStateType.Physics)

		root.AssemblyLinearVelocity = Vector3.zero
		root.AssemblyAngularVelocity = Vector3.zero
	else
		restoreHumanoidState(humanoid)
	end
end

local function teleportCharacter(character, targetPosition)
	if not character or not character.Parent then
		return
	end

	character:PivotTo(CFrame.new(targetPosition))
	hoverPosition = targetPosition
end

local function stopRoute()
	routeToken += 1
	hoverPosition = nil
	lockActive = false

	local character = getCharacter()
	if character then
		setLock(character, false)
	end
end

local function waitForCharacter(myToken)
	while enabled and routeToken == myToken do
		local character = getCharacter()
		if character then
			return character
		end
		task.wait(0.1)
	end
	return nil
end

local function runOneCycle(myToken, stepInterval)
	for index, point in ipairs(points) do
		if not enabled or routeToken ~= myToken then
			return false
		end

		local character = waitForCharacter(myToken)
		if not character then
			return false
		end

		local isLast = (index == #points)

		if isLast then
			lockActive = false
			setLock(character, false)
		else
			lockActive = true
			setLock(character, true)
		end

		local target
		if isLast then
			target = point
		else
			target = Vector3.new(
				point.X + xOffset,
				point.Y + yOffset,
				point.Z
			)
		end

		teleportCharacter(character, target)

		local elapsed = 0
		while elapsed < stepInterval do
			if not enabled or routeToken ~= myToken then
				return false
			end

			task.wait(0.05)
			elapsed += 0.05
		end
	end

	return true
end

local function startRoute()
	routeToken += 1
	local myToken = routeToken

	task.spawn(function()
		local firstCycle = true

		while enabled and routeToken == myToken do
			local stepInterval = firstCycle and FIRST_CYCLE_INTERVAL or interval
			firstCycle = false

			local ok = runOneCycle(myToken, stepInterval)
			if not ok then
				return
			end
		end
	end)
end

local function updateToggleVisual()
	if enabled then
		toggleButton.Text = "ON"
		toggleButton.BackgroundColor3 = Color3.fromRGB(70, 150, 90)
	else
		toggleButton.Text = "OFF"
		toggleButton.BackgroundColor3 = Color3.fromRGB(90, 90, 96)
	end
end

-- スライダー作成の共通関数
local function createSlider(parent, labelText, minValue, maxValue, defaultValue, step, suffix, onChanged)
	local holder = Instance.new("Frame")
	holder.Size = UDim2.new(1, 0, 0, 62)
	holder.BackgroundTransparency = 1
	holder.Parent = parent

	local label = Instance.new("TextLabel")
	label.Size = UDim2.new(1, 0, 0, 18)
	label.BackgroundTransparency = 1
	label.TextColor3 = Color3.fromRGB(235, 235, 235)
	label.Font = Enum.Font.Gotham
	label.TextSize = 14
	label.TextXAlignment = Enum.TextXAlignment.Left
	label.Text = labelText
	label.Parent = holder

	local valueLabel = Instance.new("TextLabel")
	valueLabel.Size = UDim2.new(0, 110, 0, 18)
	valueLabel.Position = UDim2.new(1, -110, 0, 0)
	valueLabel.BackgroundTransparency = 1
	valueLabel.TextColor3 = Color3.fromRGB(180, 180, 190)
	valueLabel.Font = Enum.Font.Gotham
	valueLabel.TextSize = 13
	valueLabel.TextXAlignment = Enum.TextXAlignment.Right
	valueLabel.Parent = holder

	local track = Instance.new("Frame")
	track.Size = UDim2.new(1, 0, 0, 10)
	track.Position = UDim2.new(0, 0, 0, 34)
	track.BackgroundColor3 = Color3.fromRGB(55, 55, 62)
	track.BorderSizePixel = 0
	track.Parent = holder

	local trackCorner = Instance.new("UICorner")
	trackCorner.CornerRadius = UDim.new(1, 0)
	trackCorner.Parent = track

	local fill = Instance.new("Frame")
	fill.Size = UDim2.new(0, 0, 1, 0)
	fill.BackgroundColor3 = Color3.fromRGB(120, 170, 255)
	fill.BorderSizePixel = 0
	fill.Parent = track

	local fillCorner = Instance.new("UICorner")
	fillCorner.CornerRadius = UDim.new(1, 0)
	fillCorner.Parent = fill

	local knob = Instance.new("Frame")
	knob.Size = UDim2.new(0, 18, 0, 18)
	knob.AnchorPoint = Vector2.new(0.5, 0.5)
	knob.Position = UDim2.new(0, 0, 0.5, 0)
	knob.BackgroundColor3 = Color3.fromRGB(245, 245, 250)
	knob.BorderSizePixel = 0
	knob.Parent = track

	local knobCorner = Instance.new("UICorner")
	knobCorner.CornerRadius = UDim.new(1, 0)
	knobCorner.Parent = knob

	local dragging = false

	local function formatValue(v)
		if suffix == "s" then
			return string.format("%.1f%s", v, suffix)
		end
		return tostring(math.floor(v + 0.5)) .. suffix
	end

	local function applyValue(v)
		v = math.clamp(v, minValue, maxValue)
		if step then
			v = math.floor((v / step) + 0.5) * step
			v = math.clamp(v, minValue, maxValue)
		end

		local alpha = (v - minValue) / (maxValue - minValue)
		fill.Size = UDim2.new(alpha, 0, 1, 0)
		knob.Position = UDim2.new(alpha, 0, 0.5, 0)
		valueLabel.Text = formatValue(v)
		onChanged(v)
	end

	local function setFromX(x)
		local alpha = math.clamp((x - track.AbsolutePosition.X) / track.AbsoluteSize.X, 0, 1)
		local raw = minValue + ((maxValue - minValue) * alpha)
		applyValue(raw)
	end

	local function beginDrag(input)
		dragging = true
		setFromX(input.Position.X)
	end

	track.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			beginDrag(input)
		end
	end)

	knob.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			beginDrag(input)
		end
	end)

	UserInputService.InputChanged:Connect(function(input)
		if not dragging then
			return
		end
		if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
			setFromX(input.Position.X)
		end
	end)

	UserInputService.InputEnded:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = false
		end
	end)

	applyValue(defaultValue)
end

createSlider(content, "TP Interval", 0.5, 10, interval, 0.1, "s", function(v)
	interval = v
end)

createSlider(content, "X Offset", -200, 200, xOffset, 1, "", function(v)
	xOffset = math.floor(v + 0.5)
end)

createSlider(content, "Y Offset", -200, 200, yOffset, 1, "", function(v)
	yOffset = math.floor(v + 0.5)
end)

local antiAFKHolder = Instance.new("Frame")
antiAFKHolder.Size = UDim2.new(1, 0, 0, 36)
antiAFKHolder.BackgroundTransparency = 1
antiAFKHolder.Parent = content

local antiAFKLabel = Instance.new("TextLabel")
antiAFKLabel.Size = UDim2.new(1, -90, 0, 36)
antiAFKLabel.Position = UDim2.new(0, 0, 0, 0)
antiAFKLabel.BackgroundTransparency = 1
antiAFKLabel.TextColor3 = Color3.fromRGB(235, 235, 235)
antiAFKLabel.Font = Enum.Font.Gotham
antiAFKLabel.TextSize = 14
antiAFKLabel.TextXAlignment = Enum.TextXAlignment.Left
antiAFKLabel.Text = "Anti AFK"
antiAFKLabel.Parent = antiAFKHolder

local antiAFKButton = Instance.new("TextButton")
antiAFKButton.Size = UDim2.new(0, 70, 0, 24)
antiAFKButton.Position = UDim2.new(1, -70, 0, 6)
antiAFKButton.BackgroundColor3 = Color3.fromRGB(90, 90, 96)
antiAFKButton.TextColor3 = Color3.fromRGB(255, 255, 255)
antiAFKButton.Font = Enum.Font.GothamBold
antiAFKButton.TextSize = 14
antiAFKButton.Text = "OFF"
antiAFKButton.BorderSizePixel = 0
antiAFKButton.Parent = antiAFKHolder

local antiAFKCorner = Instance.new("UICorner")
antiAFKCorner.CornerRadius = UDim.new(0, 6)
antiAFKCorner.Parent = antiAFKButton

local function updateAntiAFKVisual()
	if antiAFKEnabled then
		antiAFKButton.Text = "ON"
		antiAFKButton.BackgroundColor3 = Color3.fromRGB(70, 150, 90)
	else
		antiAFKButton.Text = "OFF"
		antiAFKButton.BackgroundColor3 = Color3.fromRGB(90, 90, 96)
	end
end

local function startAntiAFK()
	antiAFKThread = task.spawn(function()
		while antiAFKEnabled do
			task.wait(15 * 60)
			if not antiAFKEnabled then break end
			VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.Space, false, nil)
			task.wait(0.05)
			VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.Space, false, nil)
		end
	end)
end

local function stopAntiAFK()
	antiAFKEnabled = false
	if antiAFKThread then
		task.cancel(antiAFKThread)
		antiAFKThread = nil
	end
end

antiAFKButton.MouseButton1Click:Connect(function()
	antiAFKEnabled = not antiAFKEnabled
	updateAntiAFKVisual()
	if antiAFKEnabled then
		startAntiAFK()
	else
		stopAntiAFK()
	end
end)

toggleButton.MouseButton1Click:Connect(function()
	enabled = not enabled
	updateToggleVisual()

	if enabled then
		local character = getCharacter()
		if character then
			local root = character:FindFirstChild("HumanoidRootPart")
			if root then
				hoverPosition = root.Position
			end
			setLock(character, true)
			lockActive = true
		end
		startRoute()
	else
		stopRoute()
	end
end)

player.CharacterAdded:Connect(function(character)
	task.wait(0.1)

	if enabled then
		local root = character:WaitForChild("HumanoidRootPart", 5)
		if root then
			hoverPosition = root.Position
		end

		setLock(character, true)
		lockActive = true
		startRoute()
	end
end)

player.CharacterRemoving:Connect(function(character)
	local _, humanoid = getRootAndHumanoid(character)
	if humanoid then
		restoreHumanoidState(humanoid)
	end
end)

RunService.Heartbeat:Connect(function()
	if not enabled or not lockActive then
		return
	end

	local character = getCharacter()
	if not character or not hoverPosition then
		return
	end

	local root, humanoid = getRootAndHumanoid(character)
	if not root or not humanoid then
		return
	end

	setLock(character, true)
	root.AssemblyLinearVelocity = Vector3.zero
	root.AssemblyAngularVelocity = Vector3.zero
	root.CFrame = CFrame.new(hoverPosition)
end)

local draggingWindow = false
local dragStart
local startPos
local dragInput

topBar.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		draggingWindow = true
		dragStart = input.Position
		startPos = main.Position
		dragInput = input
	end
end)

topBar.InputChanged:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
		dragInput = input
	end
end)

UserInputService.InputChanged:Connect(function(input)
	if not draggingWindow then
		return
	end
	if input == dragInput then
		local delta = input.Position - dragStart
		main.Position = UDim2.new(
			startPos.X.Scale,
			startPos.X.Offset + delta.X,
			startPos.Y.Scale,
			startPos.Y.Offset + delta.Y
		)
	end
end)

UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
		draggingWindow = false
	end
end)

updateToggleVisual()
updateAntiAFKVisual()

Features & Information

BABFT babft Build a boat for treasure open source AutoFarm Keyless
#BABFT#opensource#Keyless

Community Comments (1)

purpul_g0ypurpul_g0ySep 8, 2026

sometimes freezes and stops working, this happend kinda to every script i used fir babft autofarming, also the wheel that changes the autofarm speed doesnt change the speed, wanted to change it because it skipped some stages sometimes

More Scripts for Build A Boat For Treasure