local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local pulling = true -- Starts enabled
local connection
-- Rarity list
local rarities = {
"Common",
"Uncommon",
"Rare",
"Epic",
"Legendary"
}
-- Enabled rarities
local enabled = {
Common = true,
Uncommon = true,
Rare = true,
Epic = true,
Legendary = true
}
-- Function to pull items
local function pullItems()
if not player.Character or not player.Character:FindFirstChild("HumanoidRootPart") then
return
end
local hrp = player.Character.HumanoidRootPart
local targetPos = hrp.Position + Vector3.new(0, 5, 0)
for _, rarity in ipairs(rarities) do
if enabled[rarity] then
local folder = Workspace.Map.Functional.SpawnedItems:FindFirstChild(rarity)
if folder then
for _, item in ipairs(folder:GetChildren()) do
local root = item:FindFirstChild("Root")
if root and root:IsA("BasePart") then
root.CFrame = CFrame.new(targetPos)
root.Velocity = Vector3.new(0, 0, 0)
end
end
end
end
end
end
-- Start automatic pulling immediately
local function startAutoPull()
if connection then return end
connection = RunService.RenderStepped:Connect(pullItems)
end
local function stopAutoPull()
if connection then
connection:Disconnect()
connection = nil
end
end
startAutoPull() -- Activate automatically on script execution
-- GUI creation (unchanged until ToggleBtn section)
local ScreenGui = Instance.new("ScreenGui")
local Frame = Instance.new("Frame")
local TopBar = Instance.new("Frame")
local Title = Instance.new("TextLabel")
local MinimizeBtn = Instance.new("TextButton")
local CloseBtn = Instance.new("TextButton")
local ToggleBtn = Instance.new("TextButton")
-- ... (all previous GUI setup code remains identical until ToggleBtn setup)
ToggleBtn.Parent = Frame
ToggleBtn.BackgroundColor3 = Color3.fromRGB(50, 200, 50) -- Green for ON
ToggleBtn.Position = UDim2.new(0.1, 0, 0, 45)
ToggleBtn.Size = UDim2.new(0.8, 0, 0, 40)
ToggleBtn.Font = Enum.Font.GothamBold
ToggleBtn.Text = "AUTO PULL: ON"
ToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleBtn.TextSize = 18
local toggleCorner = Instance.new("UICorner")
toggleCorner.Parent = ToggleBtn
toggleCorner.CornerRadius = UDim.new(0, 8)
-- Toggle button now controls auto-pull on/off
ToggleBtn.MouseButton1Click:Connect(function()
pulling = not pulling
if pulling then
ToggleBtn.Text = "AUTO PULL: ON"
ToggleBtn.BackgroundColor3 = Color3.fromRGB(50, 200, 50)
startAutoPull()
else
ToggleBtn.Text = "AUTO PULL: OFF"
ToggleBtn.BackgroundColor3 = Color3.fromRGB(200, 50, 50)
stopAutoPull()
end
end)
-- ... (rest of GUI code: minimized icon, rarity checkboxes, dragging, minimize/close, hotkey, etc. remains unchanged)
-- Ensure pulling stops when GUI is closed
CloseBtn.MouseButton1Click:Connect(function()
stopAutoPull()
ScreenGui:Destroy()
end)
-- Optional: stop pulling when player dies/resets (recommended)
player.CharacterAdded:Connect(function()
-- Pulling will resume automatically if still enabled
if pulling then
startAutoPull()
end
end)
player.CharacterRemoving:Connect(function()
stopAutoPull()
end)
Comments
No comments yet
Be the first to share your thoughts!