-- Xóa GUI cũ nếu có if game.CoreGui:FindFirstChild("FarmGui") then game.CoreGui.FarmGui:Destroy() end local Players = game:GetService("Players") local player = Players.LocalPlayer local TARGET_POSITION = Vector3.new(21163, 64, -772) -- ===== HÀM FARM ===== local function startFarm() getgenv().farm = true task.spawn(function() while getgenv().farm do local character = player.Character or player.CharacterAdded:Wait() if character and character:FindFirstChild("HumanoidRootPart") then character:PivotTo(CFrame.new(TARGET_POSITION)) end task.wait(1) end end) end local function stopFarm() getgenv().farm = false end -- ===== TẠO GUI ===== local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "FarmGui" ScreenGui.ResetOnSpawn = false ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling ScreenGui.Parent = game.CoreGui local Button = Instance.new("TextButton") Button.Size = UDim2.new(0, 120, 0, 50) Button.Position = UDim2.new(0, 20, 0, 20) Button.BackgroundColor3 = Color3.fromRGB(200, 50, 50) Button.TextColor3 = Color3.fromRGB(255, 255, 255) Button.Text = "FARM: OFF" Button.TextScaled = true Button.Font = Enum.Font.GothamBold Button.BorderSizePixel = 0 Button.AutoButtonColor = true Button.Parent = ScreenGui local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 8) corner.Parent = Button local stroke = Instance.new("UIStroke") stroke.Color = Color3.fromRGB(255, 255, 255) stroke.Thickness = 1.5 stroke.Parent = Button -- ===== KÉO THẢ NÚT ===== local dragging, dragStart, startPos Button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = Button.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) Button.InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart Button.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) -- ===== XỬ LÝ CLICK ===== local isOn = false Button.MouseButton1Click:Connect(function() isOn = not isOn if isOn then Button.Text = "FARM: ON" Button.BackgroundColor3 = Color3.fromRGB(50, 200, 50) startFarm() else Button.Text = "FARM: OFF" Button.BackgroundColor3 = Color3.fromRGB(200, 50, 50) stopFarm() end end)