Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local tpEnabled = false
- local walkEnabled = false
- local minimized = false
- local tpSpeed = 0.15
- local walkSpeed = 16
- local coinName = "Coin"
- local originalProperties = {}
- local function findAllCoins()
- local coins = {}
- for _, part in ipairs(workspace:GetDescendants()) do
- if part:IsA("BasePart") and part.Name == coinName then
- table.insert(coins, part)
- end
- end
- return coins
- end
- local function teleportLoop()
- while true do
- if tpEnabled then
- local character = player.Character
- local humanoid = character and character:FindFirstChildOfClass("Humanoid")
- local rootPart = character and character:FindFirstChild("HumanoidRootPart")
- if character and humanoid and rootPart then
- local coins = findAllCoins()
- for _, coin in ipairs(coins) do
- if not tpEnabled then break end
- rootPart.CFrame = CFrame.new(coin.Position + Vector3.new(0, 1, 0))
- humanoid:Move(Vector3.new(1, 0, 0), true)
- humanoid.Jump = false
- task.wait(tpSpeed)
- end
- end
- end
- task.wait(tpSpeed)
- end
- end
- task.spawn(teleportLoop)
- local function blockJoystick()
- task.spawn(function()
- local playerGui = player:WaitForChild("PlayerGui")
- local joystickFrame = nil
- for i = 1, 50 do
- local touchGui = playerGui:FindFirstChild("TouchGui", true)
- if touchGui then
- joystickFrame = touchGui:FindFirstChild("DynamicThumbstickFrame", true)
- if joystickFrame then
- break
- end
- end
- task.wait(0.2)
- end
- if joystickFrame then
- if not joystickFrame.Parent:FindFirstChild("JoystickBlocker") then
- local blocker = Instance.new("Frame")
- blocker.Name = "JoystickBlocker"
- blocker.Size = joystickFrame.Size
- blocker.Position = joystickFrame.Position
- blocker.AnchorPoint = joystickFrame.AnchorPoint
- blocker.BackgroundTransparency = 1
- blocker.ZIndex = joystickFrame.ZIndex + 99999999999999
- blocker.Active = true
- blocker.Parent = joystickFrame.Parent
- joystickFrame:GetPropertyChangedSignal("Position"):Connect(function()
- blocker.Position = joystickFrame.Position
- end)
- joystickFrame:GetPropertyChangedSignal("Size"):Connect(function()
- blocker.Size = joystickFrame.Size
- end)
- end
- else
- warn("Joystick not found to block.")
- end
- end)
- end
- local function unblockJoystick()
- local playerGui = player:FindFirstChild("PlayerGui")
- if playerGui then
- local touchGui = playerGui:FindFirstChild("TouchGui", true)
- if touchGui then
- local blocker = touchGui:FindFirstChild("JoystickBlocker", true)
- if blocker then
- blocker:Destroy()
- end
- end
- end
- end
- local screenGui = Instance.new("ScreenGui")
- screenGui.ResetOnSpawn = false
- screenGui.Parent = game.CoreGui
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 240, 0, 140)
- frame.Position = UDim2.new(0.5, -120, 0.5, -70)
- frame.BackgroundColor3 = Color3.new(0, 0, 0)
- frame.BorderSizePixel = 1
- frame.BorderColor3 = Color3.new(1, 1, 1)
- frame.Active = true
- frame.Draggable = true
- frame.Parent = screenGui
- frame.BackgroundTransparency = 0
- frame.Visible = false
- local corner = Instance.new("UICorner")
- corner.CornerRadius = UDim.new(0, 6)
- corner.Parent = frame
- local titleBar = Instance.new("Frame")
- titleBar.Size = UDim2.new(1, 0, 0, 25)
- titleBar.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
- titleBar.BorderSizePixel = 1
- titleBar.BorderColor3 = Color3.new(1, 1, 1)
- titleBar.Parent = frame
- local titleText = Instance.new("TextLabel")
- titleText.Size = UDim2.new(1, -30, 1, 0)
- titleText.Position = UDim2.new(0, 5, 0, 0)
- titleText.BackgroundTransparency = 1
- titleText.Text = "AutoFarm"
- titleText.TextColor3 = Color3.new(1, 1, 1)
- titleText.Font = Enum.Font.SourceSansBold
- titleText.TextSize = 14
- titleText.TextXAlignment = Enum.TextXAlignment.Left
- titleText.Parent = titleBar
- local minimizeButton = Instance.new("TextButton")
- minimizeButton.Size = UDim2.new(0, 25, 1, 0)
- minimizeButton.Position = UDim2.new(1, -25, 0, 0)
- minimizeButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- minimizeButton.Text = "X"
- minimizeButton.TextColor3 = Color3.new(1, 1, 1)
- minimizeButton.Font = Enum.Font.SourceSansBold
- minimizeButton.TextSize = 14
- minimizeButton.Parent = titleBar
- local minCorner = Instance.new("UICorner")
- minCorner.CornerRadius = UDim.new(0, 3)
- minCorner.Parent = minimizeButton
- local content = Instance.new("Frame")
- content.Size = UDim2.new(1, -20, 1, -35)
- content.Position = UDim2.new(0, 10, 0, 25)
- content.BackgroundTransparency = 1
- content.Parent = frame
- local tpLabel = Instance.new("TextLabel")
- tpLabel.Size = UDim2.new(0.5, -5, 0, 18)
- tpLabel.Position = UDim2.new(0, 0, 0, 10)
- tpLabel.BackgroundTransparency = 1
- tpLabel.Text = "TP Speed (s)"
- tpLabel.TextColor3 = Color3.new(1, 1, 1)
- tpLabel.Font = Enum.Font.SourceSansBold
- tpLabel.TextSize = 12
- tpLabel.Parent = content
- local walkLabel = tpLabel:Clone()
- walkLabel.Position = UDim2.new(0.5, 5, 0, 10)
- walkLabel.Text = "Walk Speed"
- walkLabel.Parent = content
- local tpBox = Instance.new("TextBox")
- tpBox.Size = UDim2.new(0.5, -5, 0, 20)
- tpBox.Position = UDim2.new(0, 0, 0, 35)
- tpBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- tpBox.TextColor3 = Color3.new(1, 1, 1)
- tpBox.Text = tostring(tpSpeed)
- tpBox.Font = Enum.Font.SourceSansBold
- tpBox.TextSize = 12
- tpBox.Parent = content
- local tpCorner = Instance.new("UICorner")
- tpCorner.CornerRadius = UDim.new(0, 5)
- tpCorner.Parent = tpBox
- tpBox.FocusLost:Connect(function(enterPressed)
- if enterPressed then
- local val = tonumber(tpBox.Text)
- if val and val > 0 then
- tpSpeed = val
- else
- tpBox.Text = tostring(tpSpeed)
- end
- end
- end)
- local walkBox = tpBox:Clone()
- walkBox.Position = UDim2.new(0.5, 5, 0, 35)
- walkBox.Text = tostring(walkSpeed)
- walkBox.Parent = content
- walkBox.FocusLost:Connect(function(enterPressed)
- if enterPressed then
- local val = tonumber(walkBox.Text)
- if val and val > 0 then
- walkSpeed = val
- else
- walkBox.Text = tostring(walkSpeed)
- end
- end
- end)
- local function updateButtonVisual(btn, isOn)
- if isOn then
- btn.BackgroundColor3 = Color3.new(1, 1, 1)
- btn.TextColor3 = Color3.new(0, 0, 0)
- else
- btn.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
- btn.TextColor3 = Color3.new(1, 1, 1)
- end
- end
- local tpButton = Instance.new("TextButton")
- tpButton.Size = UDim2.new(0.5, -5, 0, 25)
- tpButton.Position = UDim2.new(0, 0, 0, 65)
- tpButton.Text = "TP: OFF"
- tpButton.Font = Enum.Font.SourceSansBold
- tpButton.TextSize = 12
- tpButton.Parent = content
- updateButtonVisual(tpButton, tpEnabled)
- local tpBtnCorner = Instance.new("UICorner")
- tpBtnCorner.CornerRadius = UDim.new(0, 5)
- tpBtnCorner.Parent = tpButton
- tpButton.MouseButton1Click:Connect(function()
- tpEnabled = not tpEnabled
- tpButton.Text = tpEnabled and "TP: ON" or "TP: OFF"
- updateButtonVisual(tpButton, tpEnabled)
- end)
- local walkButton = tpButton:Clone()
- walkButton.Position = UDim2.new(0.5, 5, 0, 65)
- walkButton.Text = "Walk: OFF"
- walkButton.Parent = content
- updateButtonVisual(walkButton, walkEnabled)
- local walkLoopConnection = nil
- walkButton.MouseButton1Click:Connect(function()
- walkEnabled = not walkEnabled
- walkButton.Text = walkEnabled and "Walk: ON" or "Walk: OFF"
- updateButtonVisual(walkButton, walkEnabled)
- if walkEnabled then
- blockJoystick()
- walkLoopConnection = task.spawn(function()
- while walkEnabled do
- local character = player.Character
- local humanoid = character and character:FindFirstChildOfClass("Humanoid")
- local rootPart = character and character:FindFirstChild("HumanoidRootPart")
- if character and humanoid and rootPart then
- humanoid.WalkSpeed = walkSpeed
- local coins = findAllCoins()
- for _, coin in ipairs(coins) do
- if not walkEnabled then break end
- humanoid:MoveTo(coin.Position + Vector3.new(0, 1, 0))
- humanoid.MoveToFinished:Wait()
- task.wait(0.1)
- end
- end
- task.wait(0.1)
- end
- local character = player.Character
- local humanoid = character and character:FindFirstChildOfClass("Humanoid")
- if humanoid then
- humanoid.WalkSpeed = 16
- end
- end)
- else
- unblockJoystick()
- end
- end)
- local function saveOriginalProperties(obj)
- if not originalProperties[obj] then
- originalProperties[obj] = {
- TextTransparency = obj:IsA("TextLabel") or obj:IsA("TextBox") or obj:IsA("TextButton") and obj.TextTransparency or nil,
- BackgroundTransparency = obj:IsA("Frame") or obj:IsA("TextBox") or obj:IsA("TextButton") and obj.BackgroundTransparency or nil,
- BackgroundColor3 = obj.BackgroundColor3
- }
- end
- end
- local function fadeChildren(parent, targetTransparency, duration, callback)
- for _, child in pairs(parent:GetDescendants()) do
- if child:IsA("TextLabel") or child:IsA("TextBox") or child:IsA("TextButton") or child:IsA("Frame") then
- saveOriginalProperties(child)
- local props = {}
- if originalProperties[child].TextTransparency ~= nil then
- props.TextTransparency = targetTransparency
- end
- if originalProperties[child].BackgroundTransparency ~= nil then
- props.BackgroundTransparency = targetTransparency
- end
- if targetTransparency < 1 then
- props.BackgroundColor3 = originalProperties[child].BackgroundColor3
- end
- TweenService:Create(child, TweenInfo.new(duration), props):Play()
- end
- end
- task.delay(duration, function()
- if callback then callback() end
- end)
- end
- minimizeButton.MouseButton1Click:Connect(function()
- if not minimized then
- fadeChildren(content, 1, 0.3, function()
- local tween = TweenService:Create(frame, TweenInfo.new(0.4), {Size = UDim2.new(0, 240, 0, 25)})
- tween:Play()
- tween.Completed:Wait()
- minimized = true
- minimizeButton.Text = "O"
- end)
- else
- frame.Active = true
- local tween = TweenService:Create(frame, TweenInfo.new(0.4), {Size = UDim2.new(0, 240, 0, 140)})
- tween:Play()
- tween.Completed:Wait()
- fadeChildren(content, 0, 0.3)
- minimized = false
- minimizeButton.Text = "X"
- end
- end)
- local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local fadeIn = TweenService:Create(frame, tweenInfo, {BackgroundTransparency = 0})
- frame.Visible = true
- fadeIn:Play()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement