-- 1. Tworzenie małego GUI
local ScreenGui = Instance.new("ScreenGui")
local MainFrame = Instance.new("Frame")
local TextLabel = Instance.new("TextLabel")
local ToggleButton = Instance.new("TextButton")
local CloseButton = Instance.new("TextButton")
ScreenGui.Name = "MM2_FarmaGui_v5"
ScreenGui.Parent = game:GetService("CoreGui")
ScreenGui.ResetOnSpawn = false
-- Przywrócone małe wymiary okienka (250x150)
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
MainFrame.Position = UDim2.new(0.1, 0, 0.1, 0)
MainFrame.Size = UDim2.new(0, 250, 0, 150)
MainFrame.Active = true
MainFrame.Draggable = true
TextLabel.Parent = MainFrame
TextLabel.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
TextLabel.Size = UDim2.new(1, 0, 0, 30)
TextLabel.Font = Enum.Font.SourceSansBold
TextLabel.Text = "Xeno_Scripter MM2 Autofarm"
TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.TextSize = 12
CloseButton.Parent = MainFrame
CloseButton.Size = UDim2.new(0, 30, 0, 30)
CloseButton.Position = UDim2.new(1, -30, 0, 0)
CloseButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
CloseButton.Font = Enum.Font.SourceSansBold
CloseButton.Text = "X"
CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
CloseButton.TextSize = 16
ToggleButton.Parent = MainFrame
ToggleButton.Size = UDim2.new(0, 200, 0, 50)
ToggleButton.Position = UDim2.new(0, 25, 0, 65)
ToggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
ToggleButton.Font = Enum.Font.SourceSansBold
ToggleButton.Text = "Auto-Farm: OFF"
ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleButton.TextSize = 20
-- 2. Logika natychmiastowej teleportacji i stałego wymuszania pozycji
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")
local farmingActive = false
local coinsCollectedThisRound = 0
local SafeLobbySpawn = CFrame.new(45.155209, 510.391144, -29.735048) -- Twoje koordynaty w powietrzu
local function anchorCharacter(status)
local character = LocalPlayer.Character
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
if rootPart then
rootPart.Anchored = status
end
end
LocalPlayer.CharacterAdded:Connect(function()
coinsCollectedThisRound = 0
anchorCharacter(false)
end)
local function getCoins()
local coinsTable = {}
for _, obj in pairs(Workspace:GetDescendants()) do
if obj:IsA("TouchTransmitter") and obj.Parent then
local parent = obj.Parent
if parent:IsA("Part") or parent:IsA("MeshPart") then
if parent.Name == "Base" or parent.Name == "Coin" or parent.Parent.Name:find("Coin") then
table.insert(coinsTable, parent)
end
end
end
end
return coinsTable
end
-- Normalny lot do monet podczas gry
local function tweenTo(targetCFrame)
local character = LocalPlayer.Character
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
if not rootPart then return end
local distance = (rootPart.Position - targetCFrame.Position).Magnitude
if distance = 40 then
anchorCharacter(false) -- Odblokowanie na ułamek sekundy do teleportu
rootPart.CFrame = SafeLobbySpawn -- Natychmiastowy teleport bez latania [1]
task.wait(0.05)
anchorCharacter(true) -- Ponowne zamrożenie w powietrzu
ToggleButton.Text = "Full (40/40) - AFK"
else
local allCoins = getCoins()
if #allCoins > 0 then
local closestCoin = nil
local shortestDistance = math.huge
for _, coinPart in pairs(allCoins) do
if coinPart and coinPart.Parent then
local dist = (rootPart.Position - coinPart.Position).Magnitude
if dist < shortestDistance then
shortestDistance = dist
closestCoin = coinPart
end
end
end
if closestCoin and farmingActive then
tweenTo(closestCoin.CFrame)
coinsCollectedThisRound = coinsCollectedThisRound + 1
ToggleButton.Text = "Coins: " .. coinsCollectedThisRound .. "/40"
task.wait(0.2)
end
else
-- Gdy nie ma monet na mapie, też natychmiastowo teleportuje i zamraża
anchorCharacter(false)
rootPart.CFrame = SafeLobbySpawn
task.wait(0.05)
anchorCharacter(true)
end
end
end
end
end
end)
-- 3. Obsługa przycisków
ToggleButton.MouseButton1Click:Connect(function()
farmingActive = not farmingActive
if farmingActive then
ToggleButton.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
ToggleButton.Text = "Coins: " .. coinsCollectedThisRound .. "/40"
else
anchorCharacter(false)
ToggleButton.Text = "Auto-Farm: OFF"
ToggleButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
end
end)
CloseButton.MouseButton1Click:Connect(function()
farmingActive = false
anchorCharacter(false)
ScreenGui:Destroy()
end)