Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- WARNING: Heads up! This script has not been verified by ScriptBlox. Use at your own risk!
- ]]
- -- Services
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local player = Players.LocalPlayer
- local collecting = false
- local connection
- -- GUI
- local gui = Instance.new("ScreenGui")
- gui.Name = "AutoCollectGui"
- gui.ResetOnSpawn = false
- gui.Parent = player:WaitForChild("PlayerGui")
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 240, 0, 50)
- button.Position = UDim2.new(0.5, -120, 0.8, 0)
- button.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- button.TextColor3 = Color3.fromRGB(255, 255, 255)
- button.TextScaled = true
- button.Text = "Auto Collect: OFF"
- button.Parent = gui
- -- Coin teleport function
- local function teleportCoins()
- local character = player.Character
- if not character then return end
- local hrp = character:FindFirstChild("HumanoidRootPart")
- if not hrp then return end
- local eventParts = workspace:FindFirstChild("EventParts")
- if not eventParts then return end
- for _, coin in ipairs(eventParts:GetChildren()) do
- if coin:IsA("BasePart") then
- coin.CFrame = hrp.CFrame
- elseif coin:IsA("Model") then
- if not coin.PrimaryPart then
- local part = coin:FindFirstChildWhichIsA("BasePart")
- if part then
- coin.PrimaryPart = part
- end
- end
- if coin.PrimaryPart then
- coin:SetPrimaryPartCFrame(hrp.CFrame)
- end
- end
- end
- end
- -- Toggle logic
- button.MouseButton1Click:Connect(function()
- collecting = not collecting
- if collecting then
- button.Text = "Auto Collect: ON"
- button.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
- connection = RunService.Heartbeat:Connect(function()
- teleportCoins()
- end)
- else
- button.Text = "Auto Collect: OFF"
- button.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- if connection then
- connection:Disconnect()
- connection = nil
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment