Coins farm
Key Required

Coins farm

Sword AdventuresBallerofcyt3Ballerofcyt3 262 views 24 executesUpdated Feb 19, 2026
Unrated
00
Lua Script•82 lines (2376 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local plr = Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local rootPart = character:WaitForChild("HumanoidRootPart")

-- GUI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AutoCollectGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = plr.PlayerGui

local button = Instance.new("TextButton")
button.Size = UDim2.new(0, 150, 0, 50)
button.Position = UDim2.new(0, 20, 0.5, 0)
button.BackgroundColor3 = Color3.fromRGB(0, 200, 0)
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.Text = "▶ Start Auto Collect"
button.Font = Enum.Font.GothamBold
button.TextSize = 14
button.Parent = screenGui

local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 8)
corner.Parent = button

-- Lógica
local autoCollecting = false
local connection

local function startAutoCollect()
    connection = RunService.Heartbeat:Connect(function()
        local coin = workspace:FindFirstChild("Coin")
        if not coin then return end

        local coinPos = coin.Position
        local myPos = rootPart.Position
        local dist = (coinPos - myPos).Magnitude

        if dist > 3 then
            -- Vai em direção à moeda
            local direction = (coinPos - myPos).Unit
            rootPart.CFrame = rootPart.CFrame + direction * 0.5
        else
            -- Já está perto, se afasta um pouco para re-encostar
            local direction = (myPos - coinPos).Unit
            rootPart.CFrame = rootPart.CFrame + direction * 0.5
        end
    end)
end

local function stopAutoCollect()
    if connection then
        connection:Disconnect()
        connection = nil
    end
end

button.MouseButton1Click:Connect(function()
    autoCollecting = not autoCollecting

    if autoCollecting then
        button.BackgroundColor3 = Color3.fromRGB(200, 0, 0)
        button.Text = "⏹ Stop Auto Collect"
        startAutoCollect()
    else
        button.BackgroundColor3 = Color3.fromRGB(0, 200, 0)
        button.Text = "▶ Start Auto Collect"
        stopAutoCollect()
    end
end)

-- Reseta ao respawnar
plr.CharacterAdded:Connect(function(newChar)
    character = newChar
    rootPart = newChar:WaitForChild("HumanoidRootPart")
    if autoCollecting then
        stopAutoCollect()
        startAutoCollect()
    end
end)

Features & Information

-stay close enough to the coin(almost touching) and then,turn on

Community Comments (0)

No comments yet for this script.