Untitled script
About
Autofarm
Script
pbx pull g7dfgpc9e2untitled-script.luau381 lines · 9.5kb
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local env = (getgenv and getgenv()) or _G
-- Stop previous version
if env.CupTouchV31Cleanup then
pcall(env.CupTouchV31Cleanup)
env.CupTouchV31Cleanup = nil
end
local oldGui = playerGui:FindFirstChild("CupTouchToggle")
if oldGui then
oldGui:Destroy()
end
local alive = true
local initialized = false
local running = false
local deleting = true
local KICKER_POSITION = Vector3.new(-3.898, -13.526, -103.483)
local DELETE_RADIUS = 10
local connections = {}
local gui
local function track(connection)
table.insert(connections, connection)
return connection
end
local function disconnectAll()
for _, connection in ipairs(connections) do
pcall(function()
connection:Disconnect()
end)
end
table.clear(connections)
end
local function cleanup()
if not alive then return end
alive = false
initialized = false
running = false
deleting = false
disconnectAll()
if gui then
pcall(function()
gui:Destroy()
end)
end
end
env.CupTouchV31Cleanup = cleanup
-- Folder helpers
local function getGameFolder()
return workspace:FindFirstChild("Game")
end
local function getCupsFolder()
local gameFolder = getGameFolder()
return gameFolder and gameFolder:FindFirstChild("Cups")
end
local function getDropsFolder()
local gameFolder = getGameFolder()
return gameFolder and gameFolder:FindFirstChild("Drops")
end
local function getRootPart()
local character = player.Character
return character and character:FindFirstChild("HumanoidRootPart")
end
-- Touch helper
local function safeTouch(root, part)
if not alive or not root or not part then return end
if not root:IsA("BasePart") or not part:IsA("BasePart") then return end
if typeof(firetouchinterest) ~= "function" then return end
pcall(function()
firetouchinterest(root, part, 0)
task.wait()
firetouchinterest(root, part, 1)
end)
end
-- Find the best touch part inside a chest
local function getChestPart(chest)
if not chest then return nil end
local handle = chest:FindFirstChild("Handle", true)
if handle and handle:IsA("BasePart") then
return handle
end
if chest:IsA("BasePart") then
return chest
end
if chest:IsA("Model") and chest.PrimaryPart then
return chest.PrimaryPart
end
return chest:FindFirstChildWhichIsA("BasePart", true)
end
-- Cups sparkle check
local function hasChestSparkle(chest)
if not chest then return false end
local handle = chest:FindFirstChild("Handle", true)
return handle and handle:FindFirstChild("sparkle") ~= nil
end
-- Existing Cups touch behavior
local function fireFolderTouches(folder, root)
if not folder or not root then return end
for _, object in ipairs(folder:GetDescendants()) do
if not alive or not running then break end
if object:IsA("TouchTransmitter") then
safeTouch(root, object.Parent)
end
end
end
-- NEW: Direct DarkChest targeting
local function touchDarkChest(root)
local drops = getDropsFolder()
if not drops then return end
local darkChest = drops:FindFirstChild("DarkChest")
if not darkChest then
return
end
local part = getChestPart(darkChest)
if part then
safeTouch(root, part)
end
end
-- GUI
gui = Instance.new("ScreenGui")
gui.Name = "CupTouchToggle"
gui.ResetOnSpawn = false
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
gui.Parent = playerGui
local frame = Instance.new("Frame")
frame.Name = "Main"
frame.Size = UDim2.fromOffset(190, 105)
frame.Position = UDim2.new(0.5, -95, 0.5, -52)
frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
frame.BorderSizePixel = 0
frame.Active = true
frame.Parent = gui
local corner = Instance.new("UICorner")
corner.CornerRadius = UDim.new(0, 9)
corner.Parent = frame
local title = Instance.new("TextLabel")
title.Name = "DragHandle"
title.Size = UDim2.new(1, 0, 0, 34)
title.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
title.BorderSizePixel = 0
title.Text = "Cups Auto Touch V3.1"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Font = Enum.Font.GothamBold
title.TextSize = 13
title.Active = true
title.Parent = frame
local titleCorner = Instance.new("UICorner")
titleCorner.CornerRadius = UDim.new(0, 9)
titleCorner.Parent = title
local autoButton = Instance.new("TextButton")
autoButton.Size = UDim2.new(1, -20, 0, 40)
autoButton.Position = UDim2.fromOffset(10, 48)
autoButton.BackgroundColor3 = Color3.fromRGB(55, 55, 55)
autoButton.BorderSizePixel = 0
autoButton.Text = "Auto Touch: OFF"
autoButton.TextColor3 = Color3.fromRGB(255, 255, 255)
autoButton.Font = Enum.Font.Gotham
autoButton.TextSize = 12
autoButton.AutoButtonColor = false
autoButton.Active = false
autoButton.Selectable = false
autoButton.Parent = frame
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 6)
buttonCorner.Parent = autoButton
-- Mobile + PC dragging
local dragging = false
local dragStart
local startPosition
local activeTouch
track(title.InputBegan:Connect(function(input)
if not initialized or not alive then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
dragStart = input.Position
startPosition = frame.Position
elseif input.UserInputType == Enum.UserInputType.Touch then
dragging = true
activeTouch = input
dragStart = input.Position
startPosition = frame.Position
end
end))
track(UserInputService.InputChanged:Connect(function(input)
if not dragging or not initialized or not alive then return end
local isMouse = input.UserInputType == Enum.UserInputType.MouseMovement
local isTouch = input.UserInputType == Enum.UserInputType.Touch
and activeTouch ~= nil
and input == activeTouch
if isMouse or isTouch then
local delta = input.Position - dragStart
frame.Position = UDim2.new(
startPosition.X.Scale,
startPosition.X.Offset + delta.X,
startPosition.Y.Scale,
startPosition.Y.Offset + delta.Y
)
end
end))
track(UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1
or (input.UserInputType == Enum.UserInputType.Touch and input == activeTouch) then
dragging = false
activeTouch = nil
end
end))
-- Toggle
track(autoButton.MouseButton1Click:Connect(function()
if not initialized or not alive then return end
running = not running
autoButton.Text = running and "Auto Touch: ON" or "Auto Touch: OFF"
autoButton.BackgroundColor3 = running
and Color3.fromRGB(35, 115, 65)
or Color3.fromRGB(55, 55, 55)
end))
-- Auto Touch loop
task.spawn(function()
while alive and gui.Parent do
if running then
local root = getRootPart()
if root then
-- Cups
local cups = getCupsFolder()
if cups and hasChestSparkle(cups:FindFirstChild("Chest")) then
fireFolderTouches(cups, root)
end
-- Drops: specifically target DarkChest
touchDarkChest(root)
-- Also touch any other Drops parts with TouchTransmitters
local drops = getDropsFolder()
if drops then
fireFolderTouches(drops, root)
end
end
end
task.wait(0.1)Lines 1–300 of 380Open raw Find-in-page only searches the lines loaded so far. Show all loads the rest.
Changelog
1 version