
KeylessUniversal

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local player = Players.LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Name = "AutoGold 4.0"
gui.ResetOnSpawn = false
gui.Parent = player:WaitForChild("PlayerGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 280, 0, 160)
frame.Position = UDim2.new(0.5, -140, 0.18, 0)
frame.BackgroundColor3 = Color3.fromRGB(24, 24, 24)
frame.BackgroundTransparency = 0.05
frame.BorderSizePixel = 0
frame.Active = true
frame.Draggable = true
frame.Parent = gui
Instance.new("UICorner", frame)
local title = Instance.new("TextLabel", frame)
title.Size = UDim2.new(1, 0, 0, 30)
title.BackgroundTransparency = 1
title.Text = "AutoGold 4.0"
title.TextColor3 = Color3.fromRGB(255, 215, 0)
title.Font = Enum.Font.GothamBold
title.TextSize = 16
local toggleFrame = Instance.new("Frame", frame)
toggleFrame.Size = UDim2.new(0, 72, 0, 34)
toggleFrame.Position = UDim2.new(0.5, -36, 0.35, 0)
toggleFrame.BackgroundColor3 = Color3.fromRGB(140, 20, 20)
toggleFrame.BorderSizePixel = 0
Instance.new("UICorner", toggleFrame)
local toggleCircle = Instance.new("Frame", toggleFrame)
toggleCircle.Size = UDim2.new(0, 30, 0, 30)
toggleCircle.Position = UDim2.new(0, 2, 0, 2)
toggleCircle.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Instance.new("UICorner", toggleCircle)
local timerLabel = Instance.new("TextLabel", frame)
timerLabel.Size = UDim2.new(1, 0, 0, 22)
timerLabel.Position = UDim2.new(0, 0, 0.58, 0)
timerLabel.BackgroundTransparency = 1
timerLabel.Text = "Time: 00:00:00"
timerLabel.TextColor3 = Color3.fromRGB(100, 255, 255)
timerLabel.Font = Enum.Font.Code
timerLabel.TextSize = 14
local goldLabel = Instance.new("TextLabel", frame)
goldLabel.Size = UDim2.new(1, 0, 0, 22)
goldLabel.Position = UDim2.new(0, 0, 0.73, 0)
goldLabel.BackgroundTransparency = 1
goldLabel.Text = "Gold: 0"
goldLabel.TextColor3 = Color3.fromRGB(255, 215, 0)
goldLabel.Font = Enum.Font.GothamBold
goldLabel.TextSize = 15
local statusLabel = Instance.new("TextLabel", frame)
statusLabel.Size = UDim2.new(1, 0, 0, 20)
statusLabel.Position = UDim2.new(0, 0, 1, -26)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = "OFF"
statusLabel.TextColor3 = Color3.fromRGB(255, 80, 80)
statusLabel.Font = Enum.Font.GothamBold
statusLabel.TextSize = 13
local dragging, dragStart, startPos
frame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true
dragStart = input.Position
startPos = frame.Position
end
end)
frame.InputChanged:Connect(function(input)
if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
local delta = input.Position - dragStart
frame.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
dragging = false
end
end)
local userEnabled = false
local autoRunning = false
local goldCount = 0
local startTime = 0
local hrp = nil
local humanoid = nil
local function getCharacter()
local char = player.Character or player.CharacterAdded:Wait()
hrp = char:WaitForChild("HumanoidRootPart")
humanoid = char:WaitForChild("Humanoid")
end
getCharacter()
player.CharacterAdded:Connect(function()
task.wait(3)
getCharacter()
if userEnabled then
autoRunning = true
startTime = os.time()
statusLabel.Text = "RESPAWNED - SCANNING..."
statusLabel.TextColor3 = Color3.fromRGB(255, 255, 120)
task.spawn(waitForFullHealthAndScan)
end
end)
local function formatTime(seconds)
local h = math.floor(seconds / 3600)
local m = math.floor((seconds % 3600) / 60)
local s = seconds % 60
return string.format("%02d:%02d:%02d", h, m, s)
end
local function findPromptInGold(goldBar)
if not goldBar then return nil end
local p = goldBar:FindFirstChild("PickupGoldPrompt", true)
if p and p:IsA("ProximityPrompt") then return p end
return goldBar:FindFirstChildWhichIsA("ProximityPrompt", true)
end
local function safeFirePrompt(prompt)
if not prompt then return false end
local ok = pcall(function()
if typeof(prompt.RequiresLineOfSight) == "boolean" then prompt.RequiresLineOfSight = false end
if typeof(prompt.MaxActivationDistance) == "number" then prompt.MaxActivationDistance = 100 end
fireproximityprompt(prompt)
end)
if ok then
goldCount = goldCount + 1
goldLabel.Text = "Gold: " .. goldCount
end
return ok
end
local function hasGold()
local folder = workspace:FindFirstChild("GoldBars")
if not folder then return false end
for _, obj in pairs(folder:GetChildren()) do
local prompt = findPromptInGold(obj)
if prompt and prompt.Enabled then return true end
end
return false
end
function waitForFullHealthAndScan()
while humanoid and humanoid.Health < humanoid.MaxHealth do
task.wait(0.5)
end
statusLabel.Text = "FULL HP - SCANNING..."
task.spawn(waitForGoldAndStartFarm)
end
function waitForGoldAndStartFarm()
while autoRunning and not hasGold() do
statusLabel.Text = "WAITING GOLD..."
statusLabel.TextColor3 = Color3.fromRGB(255, 255, 120)
task.wait(2)
end
if autoRunning and hasGold() then
statusLabel.Text = "GOLD SPAWNED!"
task.wait(1)
task.spawn(scannerLoop)
end
end
function scannerLoop()
local noGoldCount = 0
while autoRunning do
local folder = workspace:FindFirstChild("GoldBars")
if not folder then
task.wait(1)
continue
end
local goldList = {}
for _, gb in pairs(folder:GetChildren()) do
local prompt = findPromptInGold(gb)
if prompt and prompt.Enabled then
local part = gb.PrimaryPart or gb:FindFirstChildWhichIsA("BasePart", true)
if part and hrp then
local dist = (part.Position - hrp.Position).Magnitude
table.insert(goldList, {gold = gb, prompt = prompt, part = part, dist = dist})
end
end
end
if #goldList == 0 then
noGoldCount = noGoldCount + 1
statusLabel.Text = "NO GOLD (" .. noGoldCount .. ")"
statusLabel.TextColor3 = Color3.fromRGB(255, 150, 80)
if noGoldCount >= 10 then
statusLabel.Text = "AUTO KILL..."
task.wait(0.5)
if humanoid then humanoid.Health = 0 end
break
end
task.wait(0.1)
continue
end
noGoldCount = 0
statusLabel.Text = "FARMING (" .. #goldList .. ")"
statusLabel.TextColor3 = Color3.fromRGB(120, 255, 120)
table.sort(goldList, function(a, b) return a.dist < b.dist end)
for _, entry in ipairs(goldList) do
if not autoRunning then break end
local gb, prompt, tpPart = entry.gold, entry.prompt, entry.part
if hrp then
hrp.CFrame = tpPart.CFrame + Vector3.new(0, 3, 0)
task.wait(0.25)
end
safeFirePrompt(prompt)
task.wait(0.15)
end
task.wait(1)
end
end
spawn(function()
while task.wait(1) do
if autoRunning and startTime > 0 then
timerLabel.Text = "Time: " .. formatTime(math.floor(os.time() - startTime))
end
end
end)
local function setUserToggle(state)
userEnabled = state
if state then
autoRunning = true
startTime = os.time()
statusLabel.Text = "FARMING..."
statusLabel.TextColor3 = Color3.fromRGB(120, 255, 120)
TweenService:Create(toggleFrame, TweenInfo.new(0.18), {BackgroundColor3 = Color3.fromRGB(20, 150, 20)}):Play()
TweenService:Create(toggleCircle, TweenInfo.new(0.18), {Position = UDim2.new(1, -32, 0, 2)}):Play()
task.spawn(scannerLoop)
else
autoRunning = false
if hrp then hrp.Anchored = false end
statusLabel.Text = "OFF"
statusLabel.TextColor3 = Color3.fromRGB(255, 80, 80)
TweenService:Create(toggleFrame, TweenInfo.new(0.18), {BackgroundColor3 = Color3.fromRGB(140, 20, 20)}):Play()
TweenService:Create(toggleCircle, TweenInfo.new(0.18), {Position = UDim2.new(0, 2, 0, 2)}):Play()
end
end
toggleFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
setUserToggle(not userEnabled)
end
end)
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.P then
setUserToggle(not userEnabled)
end
end)
setUserToggle(false)



I've made some modifications to the script so that players can farm gold infinitely without it stopping when there's no gold available. I added an automatic reset feature: when you’re in the safe zone in the sky, the script will reset your character. This way, you start fresh and can keep farming gold again because gold doesn't res* unless you reset or res* your character. Additionally, I noticed that sometimes when you reset your character, it would freeze unless you toggle the farm button off and then back on, which restores your position correctly. I've fixed that issue too. Now, you can AFK farm gold endlessly without any interruptions. The script handles resets smoothly, so your farming won't be interrupted or frozen anymore.
@Despro_2 Isn't it true that when you're in the sky with about 100 studs you're immortal?
click on my profile for the code
Yeah, you're right but gold only spawn back when you die and your character spawn back. I tried manually clicking the reset button to make my character return to the spawn point, but I ended up getting stuck in the sky without it actually resetting or bringing me back to my original spawn position. It only works if I turn off autofarm then it will resets properly and teleports me back to spawn position. So, I fixed that by making it so that when you click reset button, it automatically brings you back to your starting position without needing to toggle autofarm off. I also added an automatic reset feature, so it will reset you whenever no more gold is found. This way, you won’t have to manually click the reset button anymore.
@Despro_2 but i already added it