local plr = game:GetService("Players").LocalPlayer local uis = game:GetService("UserInputService") local ts = game:GetService("TweenService") local trees = workspace:WaitForChild("HalloweenDoorTrees") local on = false -- gui stuff local gui = Instance.new("ScreenGui") local btn = Instance.new("TextButton") local corner = Instance.new("UICorner") gui.Name = "CandyFarm" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.DisplayOrder = 999 btn.Size = UDim2.fromOffset(110, 34) btn.Position = UDim2.fromOffset(20, 120) btn.BackgroundColor3 = Color3.fromRGB(13, 13, 16) btn.AutoButtonColor = false btn.Font = Enum.Font.Cartoon btn.TextSize = 18 btn.Text = "candy farm" btn.TextColor3 = Color3.fromRGB(140, 140, 150) btn.Parent = gui corner.CornerRadius = UDim.new(0, 10) corner.Parent = btn gui.Parent = gethui and gethui() or game:GetService("CoreGui") local info = TweenInfo.new(0.12) local drag, dragged, active, startIn, startPos, conn local function set() ts:Create(btn, info, { TextColor3 = on and Color3.new(1, 1, 1) or Color3.fromRGB(140, 140, 150), BackgroundColor3 = on and Color3.fromRGB(38, 38, 46) or Color3.fromRGB(13, 13, 16) }):Play() end btn.InputBegan:Connect(function(i) if drag then return end if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then drag = true dragged = false active = i.UserInputType == Enum.UserInputType.Touch and i or nil startIn = i.Position startPos = btn.Position if conn then conn:Disconnect() end conn = uis.InputChanged:Connect(function(m) if not drag then return end if active then if m ~= active then return end elseif m.UserInputType ~= Enum.UserInputType.MouseMovement then return end local d = m.Position - startIn if not dragged and d.Magnitude > 8 then dragged = true end if dragged then btn.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + d.X, startPos.Y.Scale, startPos.Y.Offset + d.Y) end end) end end) uis.InputEnded:Connect(function(i) if not drag then return end if (active and i == active) or (not active and i.UserInputType == Enum.UserInputType.MouseButton1) then drag = false active = nil if conn then conn:Disconnect() conn = nil end if not dragged then on = not on set() end end end) -- candy farm logic while true do if on then local frames = {} for _, tree in ipairs(trees:GetChildren()) do for _, door in ipairs(tree:GetChildren()) do local frame = door:FindFirstChild("Frame") if frame then table.insert(frames, frame) end end end for _, frame in ipairs(frames) do while on and frame:IsDescendantOf(workspace) do local char = plr.Character local root = char and char:FindFirstChild("HumanoidRootPart") local prompt = frame:FindFirstChild("TrickOrTreat") if not prompt then break end if root then root.CFrame = CFrame.new(frame:GetPivot().Position - Vector3.new(0, 4, 0)) root.AssemblyLinearVelocity = Vector3.zero fireproximityprompt(prompt) end task.wait() end if not on then break end end end task.wait() end