local CoreGui = game:GetService("CoreGui") local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer local TargetParent = LocalPlayer:WaitForChild("PlayerGui") local success, _ = pcall(function() local test = CoreGui.Name TargetParent = CoreGui end) -- Clean up any old instances to prevent duplication if TargetParent:FindFirstChild("DropBallSpammer") then TargetParent:FindFirstChild("DropBallSpammer"):Destroy() end local UserInputService = game:GetService("UserInputService") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- State variables local isFiringEnabled = false local spamTask = nil local fireDelay = 0.0 -- Default speed (0 = max speed) -- Create ScreenGui local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "DropBallSpammer" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = TargetParent -- Main Toggle Button local ToggleButton = Instance.new("TextButton") ToggleButton.Name = "ToggleButton" ToggleButton.Size = UDim2.new(0, 160, 0, 40) ToggleButton.Position = UDim2.new(0, 10, 0.5, -20) ToggleButton.BackgroundColor3 = Color3.fromRGB(180, 50, 50) ToggleButton.Text = "Spammer: OFF" ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) ToggleButton.Font = Enum.Font.GothamBold ToggleButton.TextSize = 14 ToggleButton.BorderSizePixel = 0 ToggleButton.ZIndex = 10 ToggleButton.Parent = ScreenGui local UICorner = Instance.new("UICorner") UICorner.CornerRadius = UDim.new(0, 6) UICorner.Parent = ToggleButton local UIStroke = Instance.new("UIStroke") UIStroke.Color = Color3.fromRGB(0, 0, 0) UIStroke.Thickness = 1 UIStroke.Transparency = 0.6 UIStroke.Parent = ToggleButton --- FIX: Slider attached to ScreenGui, NOT the button --- -- Slider Track local SliderTrack = Instance.new("Frame") SliderTrack.Name = "SliderTrack" SliderTrack.Size = UDim2.new(0, 160, 0, 6) SliderTrack.BackgroundColor3 = Color3.fromRGB(40, 40, 40) SliderTrack.BorderSizePixel = 0 SliderTrack.ZIndex = 10 SliderTrack.Parent = ScreenGui local TrackCorner = Instance.new("UICorner") TrackCorner.CornerRadius = UDim.new(0, 3) TrackCorner.Parent = SliderTrack -- Slider Knob local SliderHandle = Instance.new("TextButton") SliderHandle.Name = "SliderHandle" SliderHandle.Size = UDim2.new(0, 14, 0, 14) SliderHandle.Position = UDim2.new(0, -7, 0.5, -7) SliderHandle.BackgroundColor3 = Color3.fromRGB(220, 220, 220) SliderHandle.Text = "" SliderHandle.BorderSizePixel = 0 SliderHandle.ZIndex = 11 SliderHandle.Parent = SliderTrack local HandleCorner = Instance.new("UICorner") HandleCorner.CornerRadius = UDim.new(1, 0) HandleCorner.Parent = SliderHandle -- Slider Text Display local SliderLabel = Instance.new("TextLabel") SliderLabel.Name = "SliderLabel" SliderLabel.Size = UDim2.new(0, 160, 0, 15) SliderLabel.BackgroundTransparency = 1 SliderLabel.Text = "Delay: 0.00s (Max)" SliderLabel.TextColor3 = Color3.fromRGB(255, 255, 255) SliderLabel.Font = Enum.Font.GothamSemibold SliderLabel.TextSize = 10 SliderLabel.ZIndex = 10 SliderLabel.Parent = ScreenGui -- Keeps the slider locked relative to the button when dragging local function syncSliderPosition() SliderTrack.Position = ToggleButton.Position + UDim2.new(0, 0, 0, 46) SliderLabel.Position = ToggleButton.Position + UDim2.new(0, 0, 0, 56) end syncSliderPosition() -- Initial setup --------------------------------------------------------- -- Dragging Support local dragging, dragInput, dragStart, startPos local function update(input) local delta = input.Position - dragStart ToggleButton.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y) syncSliderPosition() -- Update slider positions along with button end ToggleButton.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = ToggleButton.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) ToggleButton.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then dragInput = input end end) UserInputService.InputChanged:Connect(function(input) if input == dragInput and dragging then update(input) end end) -- Slider Drag Logic local sliderDragging = false local maxDelay = 1.0 local function updateSlider(input) local trackWidth = SliderTrack.AbsoluteSize.X local mouseX = input.Position.X - SliderTrack.AbsolutePosition.X local percentage = math.clamp(mouseX / trackWidth, 0, 1) SliderHandle.Position = UDim2.new(percentage, -7, 0.5, -7) fireDelay = percentage * maxDelay if fireDelay <= 0.01 then SliderLabel.Text = "Delay: 0.00s (Max)" else SliderLabel.Text = string.format("Delay: %.2fs", fireDelay) end end SliderHandle.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then sliderDragging = true input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then sliderDragging = false end end) end end) UserInputService.InputChanged:Connect(function(input) if sliderDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then updateSlider(input) end end) -- UI State & Remote Firing Logic local function updateGUI() if isFiringEnabled then ToggleButton.BackgroundColor3 = Color3.fromRGB(50, 160, 50) ToggleButton.Text = "Spammer: ON" spamTask = task.spawn(function() local remote = ReplicatedStorage:FindFirstChild("DropBallEvent") or ReplicatedStorage:WaitForChild("DropBallEvent", 3) if remote then while isFiringEnabled do remote:Fire() if fireDelay > 0 then task.wait(fireDelay) else task.wait() end end else warn("DropBallEvent could not be found in ReplicatedStorage.") isFiringEnabled = false updateGUI() end end) else ToggleButton.BackgroundColor3 = Color3.fromRGB(180, 50, 50) ToggleButton.Text = "Spammer: OFF" if spamTask then spamTask = nil end end end -- Click Toggle ToggleButton.MouseButton1Click:Connect(function() isFiringEnabled = not isFiringEnabled updateGUI() end)