
Keyless

local Players = game:GetService("Players")
local VirtualInputManager = game:GetService("VirtualInputManager")
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
-- Constants
local DREAM_POS = Vector3.new(67.3107605, -14.9960022, -235.971313)
local DIAMOND_POS = Vector3.new(67.3107605, -25.9083557, -235.971313)
local DREAM_SWORD = "DreamgazePeriastron"
local DIAMOND_SWORD = "DiamondBladeSword"
local TARGET_DREAM = 2
local TARGET_DIAMOND = 1
-- State Variables
local isRunning = false
local currentPhase = "Paused"
local attackMode = "Behind"
local originalCameraType = Camera.CameraType
local originalCameraMode = LocalPlayer.CameraMode
local originalMinZoom = LocalPlayer.CameraMinZoomDistance
local originalMaxZoom = LocalPlayer.CameraMaxZoomDistance
-----------------------------------
-- GUI CREATION
-----------------------------------
local existingGui = CoreGui:FindFirstChild("MacroControlPanel") or LocalPlayer.PlayerGui:FindFirstChild("MacroControlPanel")
if existingGui then existingGui:Destroy() end
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "MacroControlPanel"
ScreenGui.ResetOnSpawn = false
local success = pcall(function() ScreenGui.Parent = CoreGui end)
if not success then ScreenGui.Parent = LocalPlayer:WaitForChild("PlayerGui") end
local MainFrame = Instance.new("Frame")
MainFrame.Size = UDim2.new(0, 250, 0, 215)
MainFrame.Position = UDim2.new(0.5, -125, 0.8, 0)
MainFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
MainFrame.BorderSizePixel = 0
MainFrame.Active = true
MainFrame.Draggable = true
MainFrame.Parent = ScreenGui
local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 8)
UICorner.Parent = MainFrame
local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, 0, 0, 30)
Title.BackgroundTransparency = 1
Title.Text = "🗡️ Auto-Farm Macro V9"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.Font = Enum.Font.GothamBold
Title.TextSize = 16
Title.Parent = MainFrame
local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(1, -20, 0, 30)
StatusLabel.Position = UDim2.new(0, 10, 0, 35)
StatusLabel.BackgroundColor3 = Color3.fromRGB(40, 40, 45)
StatusLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
StatusLabel.Font = Enum.Font.GothamSemibold
StatusLabel.TextSize = 13
StatusLabel.Text = "Status: Paused"
StatusLabel.Parent = MainFrame
local StatusCorner = Instance.new("UICorner")
StatusCorner.CornerRadius = UDim.new(0, 4)
StatusCorner.Parent = StatusLabel
-- ATTACK MODE TOGGLE
local ModeButton = Instance.new("TextButton")
ModeButton.Size = UDim2.new(1, -20, 0, 30)
ModeButton.Position = UDim2.new(0, 10, 0, 75)
ModeButton.BackgroundColor3 = Color3.fromRGB(80, 80, 180)
ModeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ModeButton.Font = Enum.Font.GothamBold
ModeButton.TextSize = 14
ModeButton.Text = "Attack: Behind"
ModeButton.Parent = MainFrame
local ModeCorner = Instance.new("UICorner")
ModeCorner.CornerRadius = UDim.new(0, 4)
ModeCorner.Parent = ModeButton
-- TARGET INPUT BOX
local TargetBox = Instance.new("TextBox")
TargetBox.Size = UDim2.new(1, -20, 0, 30)
TargetBox.Position = UDim2.new(0, 10, 0, 115)
TargetBox.BackgroundColor3 = Color3.fromRGB(15, 15, 20)
TargetBox.TextColor3 = Color3.fromRGB(255, 255, 255)
TargetBox.PlaceholderText = "Target Name (Blank = All)"
TargetBox.PlaceholderColor3 = Color3.fromRGB(130, 130, 130)
TargetBox.Font = Enum.Font.Gotham
TargetBox.TextSize = 13
TargetBox.Text = ""
TargetBox.ClearTextOnFocus = false
TargetBox.Parent = MainFrame
local TargetCorner = Instance.new("UICorner")
TargetCorner.CornerRadius = UDim.new(0, 4)
TargetCorner.Parent = TargetBox
local ToggleButton = Instance.new("TextButton")
ToggleButton.Size = UDim2.new(1, -20, 0, 40)
ToggleButton.Position = UDim2.new(0, 10, 0, 155)
ToggleButton.BackgroundColor3 = Color3.fromRGB(40, 200, 90)
ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleButton.Font = Enum.Font.GothamBold
ToggleButton.TextSize = 18
ToggleButton.Text = "START"
ToggleButton.Parent = MainFrame
local BtnCorner = Instance.new("UICorner")
BtnCorner.CornerRadius = UDim.new(0, 6)
BtnCorner.Parent = ToggleButton
local function setStatus(text)
if StatusLabel then StatusLabel.Text = text end
end
ModeButton.MouseButton1Click:Connect(function()
if attackMode == "Behind" then
attackMode = "Under"
ModeButton.Text = "Attack: Underground"
ModeButton.BackgroundColor3 = Color3.fromRGB(180, 120, 40)
else
attackMode = "Behind"
ModeButton.Text = "Attack: Behind"
ModeButton.BackgroundColor3 = Color3.fromRGB(80, 80, 180)
end
end)
-----------------------------------
-- SAFETY & HELPER FUNCTIONS
-----------------------------------
local function isDead()
local char = LocalPlayer.Character
if not char then return true end
local hum = char:FindFirstChild("Humanoid")
return not hum or hum.Health <= 0
end
local function restoreCamera()
Camera.CameraType = Enum.CameraType.Custom
LocalPlayer.CameraMode = Enum.CameraMode.Classic
LocalPlayer.CameraMinZoomDistance = 0.5
LocalPlayer.CameraMaxZoomDistance = 400
end
local function forceCameraZoom(dist)
LocalPlayer.CameraMode = Enum.CameraMode.Classic
LocalPlayer.CameraMinZoomDistance = dist
LocalPlayer.CameraMaxZoomDistance = dist
Camera.CameraType = Enum.CameraType.Custom
task.wait(0.1)
LocalPlayer.CameraMinZoomDistance = 0.5
LocalPlayer.CameraMaxZoomDistance = 400
end
local function safeUnanchor()
local char = LocalPlayer.Character
if char and char.PrimaryPart then
char.PrimaryPart.Anchored = false
end
end
local function getToolCount(toolName)
local count = 0
local bp = LocalPlayer:FindFirstChild("Backpack")
local char = LocalPlayer.Character
if bp then for _, v in ipairs(bp:GetChildren()) do if v.Name == toolName then count += 1 end end end
if char then for _, v in ipairs(char:GetChildren()) do if v.Name == toolName then count += 1 end end end
return count
end
local function unequipTools()
local char = LocalPlayer.Character
if char and char:FindFirstChild("Humanoid") then
char.Humanoid:UnequipTools()
end
end
local function pickupTools(targetToolName)
local char = LocalPlayer.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return end
for _, obj in ipairs(workspace:GetDescendants()) do
if obj:IsA("Tool") and obj.Name == targetToolName and obj:FindFirstChild("Handle") then
if typeof(firetouchinterest) == "function" then
firetouchinterest(char.HumanoidRootPart, obj.Handle, 0)
task.wait()
firetouchinterest(char.HumanoidRootPart, obj.Handle, 1)
else
char:PivotTo(obj.Handle.CFrame)
task.wait(0.05)
end
end
end
end
-----------------------------------
-- MACRO LOGIC
-----------------------------------
local function farmMachine(targetPos, clicks, toolName)
local char = LocalPlayer.Character
if not char or not char:FindFirstChild("HumanoidRootPart") then return end
safeUnanchor()
unequipTools()
currentPhase = "Farming"
LocalPlayer.CameraMode = Enum.CameraMode.Classic
LocalPlayer.CameraMinZoomDistance = 4
LocalPlayer.CameraMaxZoomDistance = 4
Camera.CameraType = Enum.CameraType.Custom
local offsetPos = targetPos + Vector3.new(0, 0, 4)
char:PivotTo(CFrame.lookAt(offsetPos, targetPos))
task.wait(0.2)
Camera.CameraType = Enum.CameraType.Scriptable
local screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
for i = 1, clicks do
if not isRunning or isDead() then break end
Camera.CFrame = CFrame.lookAt(Camera.CFrame.Position, targetPos)
VirtualInputManager:SendMouseButtonEvent(screenCenter.X, screenCenter.Y, 0, true, game, 1)
task.wait(0.01)
VirtualInputManager:SendMouseButtonEvent(screenCenter.X, screenCenter.Y, 0, false, game, 1)
task.wait(0.01)
end
if isRunning and not isDead() then
pickupTools(toolName)
task.wait(0.1)
unequipTools()
end
Camera.CameraType = Enum.CameraType.Custom
end
local function macroLoop()
while true do
if not isRunning then
task.wait(0.5)
continue
end
if isDead() then
setStatus("Waiting to respawn...")
task.wait(1)
continue
end
-- PHASE 1: FARMING
if getToolCount(DIAMOND_SWORD) < TARGET_DIAMOND or getToolCount(DREAM_SWORD) < TARGET_DREAM then
currentPhase = "Farming"
setStatus("Phase 1: Farming Tools...")
if getToolCount(DIAMOND_SWORD) < TARGET_DIAMOND and isRunning then
setStatus("Farming Diamond...")
farmMachine(DIAMOND_POS, 50, DIAMOND_SWORD)
task.wait(0.2)
end
if getToolCount(DREAM_SWORD) < TARGET_DREAM and isRunning then
setStatus("Farming Dreamgaze...")
farmMachine(DREAM_POS, 50, DREAM_SWORD)
task.wait(0.2)
end
continue
end
-- PHASE 2: COMBAT PREP
if not isRunning then continue end
currentPhase = "Combat"
setStatus("Phase 2: Preparing Combat...")
unequipTools()
forceCameraZoom(16.3)
task.wait(0.2)
local bp = LocalPlayer:FindFirstChild("Backpack")
local dreamSwordsList = {}
if bp then
for _, item in ipairs(bp:GetChildren()) do
if item.Name == DREAM_SWORD then
table.insert(dreamSwordsList, item)
end
end
end
local currentDreamIndex = 1
local totalDreams = #dreamSwordsList
local screenCenter = Vector2.new(Camera.ViewportSize.X / 2, Camera.ViewportSize.Y / 2)
while isRunning and not isDead() do
local char = LocalPlayer.Character
local hum = char and char:FindFirstChild("Humanoid")
local dreamTool = dreamSwordsList[currentDreamIndex]
local hrp = char and char:FindFirstChild("HumanoidRootPart")
if dreamTool and dreamTool.Parent and hrp then
setStatus("Combat: Buffing (Cycle " .. currentDreamIndex .. "/" .. totalDreams .. ")")
hum:EquipTool(dreamTool)
-- Fire Dreamgaze Ability
local dreamRemote = dreamTool:FindFirstChild("Remote")
if dreamRemote then
dreamRemote:FireServer(Enum.KeyCode.Q)
end
task.wait(0.1)
-- Equip Diamond Sword & Fire Abilities
local diamondTool = bp:FindFirstChild(DIAMOND_SWORD) or char:FindFirstChild(DIAMOND_SWORD)
if diamondTool then
hum:EquipTool(diamondTool)
-- NEW: UNLEASH DIAMOND SWORD ABILITIES
local diamondRemote = diamondTool:FindFirstChild("Remote")
if diamondRemote then
diamondRemote:FireServer(Enum.KeyCode.Q) -- Diamond Rain
diamondRemote:FireServer(Enum.KeyCode.E) -- Secondary Ability
diamondRemote:FireServer(Enum.KeyCode.X) -- Tertiary Ability
end
end
setStatus("Combat: Attacking (" .. attackMode .. ")")
local startTime = tick()
while isRunning and not isDead() and tick() - startTime < 20 do
-- Dynamic Target Generation
local targetsToAttack = {}
local searchText = TargetBox.Text:lower()
if searchText ~= "" then
for _, p in ipairs(Players:GetPlayers()) do
if p ~= LocalPlayer then
if string.find(string.lower(p.Name), searchText) or string.find(string.lower(p.DisplayName), searchText) then
table.insert(targetsToAttack, p)
break
end
end
end
else
for _, p in ipairs(Players:GetPlayers()) do
if p ~= LocalPlayer then
table.insert(targetsToAttack, p)
end
end
end
-- Attack Iteration
for _, player in ipairs(targetsToAttack) do
if player.Character and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then
local targetChar = player.Character
local targetPart = targetChar:FindFirstChild("Torso") or targetChar:FindFirstChild("UpperTorso")
if targetPart and isRunning then
if attackMode == "Under" then
hrp.Anchored = true
local underPos = Vector3.new(targetPart.Position.X, -31.5, targetPart.Position.Z)
char:PivotTo(CFrame.lookAt(underPos, targetPart.Position))
else
hrp.Anchored = false
char:PivotTo(targetPart.CFrame * CFrame.new(0, 0, 1.5))
end
-- The camera naturally looks directly at the enemy due to CFrame.lookAt.
-- When the server asks for the mouse position to drop the Diamond Rain,
-- it will perfectly calculate the enemy's location!
VirtualInputManager:SendMouseButtonEvent(screenCenter.X, screenCenter.Y, 0, true, game, 1)
task.wait(0.01)
VirtualInputManager:SendMouseButtonEvent(screenCenter.X, screenCenter.Y, 0, false, game, 1)
-- Instant Kill Aura Check
local handle = diamondTool:FindFirstChild("Handle")
if handle and typeof(firetouchinterest) == "function" then
local targetLimbs = {
--targetChar:FindFirstChild("Left Leg"),
--targetChar:FindFirstChild("Right Leg"),
targetChar:FindFirstChild("LowerTorso"),
targetChar:FindFirstChild("Torso"),
targetPart
}
for _, limb in ipairs(targetLimbs) do
if limb then
firetouchinterest(handle, limb, 0)
task.wait()
firetouchinterest(handle, limb, 1)
end
end
end
task.wait(0.1)
end
end
end
task.wait(0.05)
end
currentDreamIndex = (currentDreamIndex % totalDreams) + 1
else
setStatus("Tools lost! Returning to Phase 1...")
break
end
end
safeUnanchor()
end
end
-----------------------------------
-- BUTTON TOGGLE LOGIC
-----------------------------------
ToggleButton.MouseButton1Click:Connect(function()
isRunning = not isRunning
if isRunning then
originalMinZoom = LocalPlayer.CameraMinZoomDistance
originalMaxZoom = LocalPlayer.CameraMaxZoomDistance
ToggleButton.Text = "STOP"
ToggleButton.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
setStatus("Starting Macro...")
else
ToggleButton.Text = "START"
ToggleButton.BackgroundColor3 = Color3.fromRGB(40, 200, 90)
setStatus("Status: Paused")
currentPhase = "Paused"
safeUnanchor()
restoreCamera()
unequipTools()
end
end)
-----------------------------------
-- BACKGROUND CAMERA AUTO-FIXER
-----------------------------------
task.spawn(function()
while true do
task.wait(5)
if currentPhase ~= "Farming" then
if Camera.CameraType == Enum.CameraType.Scriptable then
Camera.CameraType = Enum.CameraType.Custom
end
if LocalPlayer.CameraMinZoomDistance == 4 and LocalPlayer.CameraMaxZoomDistance == 4 then
LocalPlayer.CameraMinZoomDistance = 0.5
LocalPlayer.CameraMaxZoomDistance = 400
end
end
end
end)
task.spawn(macroLoop)No comments yet for this script.
