local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))() local Window = Rayfield:CreateWindow({ Name = "Hitbox", LoadingTitle = "Hitbox", ConfigurationSaving = { Enabled = false } }) local DiscordTab = Window:CreateTab("Discord", 4483362458) DiscordTab:CreateSection("Welcome!") DiscordTab:CreateLabel("Join my Discord for updates, support, and more.") DiscordTab:CreateLabel("https://discord.gg/cZWghBDNEG") DiscordTab:CreateButton({ Name = "Copy & Join Discord", Callback = function() setclipboard("https://discord.gg/cZWghBDNEG") Rayfield:Notify({ Title = "Copied!", Content = "Discord link copied to clipboard.", Duration = 4, Image = 4483362458, }) end }) local MainTab = Window:CreateTab("Hitbox", 4483362458) local BALL_NAME = "CLIENT_BALL" local HitboxEnabled = false local HitboxSize = 15 local MIN_SIZE = 6 local MAX_SIZE = 50 local Hitboxes = {} local TrackedBalls = {} local TouchingParts = {} local function isBall(object) return object:IsA("Model") and string.find(object.Name, BALL_NAME, 1, true) ~= nil end local function getBallPart(ballModel) if ballModel.PrimaryPart then return ballModel.PrimaryPart end return ballModel:FindFirstChildWhichIsA("BasePart", true) end local function onHitboxTouched(ballModel, touchedPart) if touchedPart:IsDescendantOf(ballModel) then return end end local function removeHitbox(ballModel) local hitbox = Hitboxes[ballModel] if hitbox and hitbox.Parent then hitbox:Destroy() end Hitboxes[ballModel] = nil TouchingParts[ballModel] = nil end local function createHitbox(ballModel) if not HitboxEnabled then return end if not ballModel or not ballModel.Parent then return end local ballPart = getBallPart(ballModel) if not ballPart then return end local existing = Hitboxes[ballModel] if existing and existing.Parent then existing.Size = Vector3.new(HitboxSize, HitboxSize, HitboxSize) return end local hitbox = Instance.new("Part") hitbox.Name = "Hitbox" hitbox.Shape = Enum.PartType.Ball hitbox.Size = Vector3.new(HitboxSize, HitboxSize, HitboxSize) hitbox.CFrame = ballPart.CFrame hitbox.Color = Color3.fromRGB(50, 255, 100) hitbox.Material = Enum.Material.ForceField hitbox.Transparency = 0.65 hitbox.CanCollide = false hitbox.CanTouch = true hitbox.CanQuery = true hitbox.CastShadow = false hitbox.Massless = true hitbox.Anchored = false hitbox.Parent = ballModel local weld = Instance.new("WeldConstraint") weld.Name = "Hitbox" weld.Part0 = ballPart weld.Part1 = hitbox weld.Parent = hitbox Hitboxes[ballModel] = hitbox TouchingParts[ballModel] = {} hitbox.Touched:Connect(function(otherPart) if HitboxEnabled then onHitboxTouched(ballModel, otherPart) end end) end local function trackBall(ballModel) if TrackedBalls[ballModel] then return end TrackedBalls[ballModel] = true if HitboxEnabled then createHitbox(ballModel) end ballModel.AncestryChanged:Connect(function(_, parent) if parent == nil then removeHitbox(ballModel) TrackedBalls[ballModel] = nil end end) end local function scanForBalls() for _, object in ipairs(Workspace:GetDescendants()) do if isBall(object) then trackBall(object) end end end local function enableHitboxes() HitboxEnabled = true for ballModel in pairs(TrackedBalls) do if ballModel.Parent then createHitbox(ballModel) end end end local function disableHitboxes() HitboxEnabled = false for ballModel in pairs(Hitboxes) do removeHitbox(ballModel) end table.clear(Hitboxes) table.clear(TouchingParts) end local function setHitboxSize(size) HitboxSize = math.clamp(math.round(size), MIN_SIZE, MAX_SIZE) for ballModel, hitbox in pairs(Hitboxes) do if ballModel.Parent and hitbox.Parent then hitbox.Size = Vector3.new(HitboxSize, HitboxSize, HitboxSize) else Hitboxes[ballModel] = nil end end end RunService.Heartbeat:Connect(function() if not HitboxEnabled then return end for ballModel, hitbox in pairs(Hitboxes) do if not ballModel.Parent or not hitbox.Parent then removeHitbox(ballModel) continue end local overlapParams = OverlapParams.new() overlapParams.FilterType = Enum.RaycastFilterType.Exclude overlapParams.FilterDescendantsInstances = { ballModel } local currentParts = {} for _, part in ipairs(Workspace:GetPartsInPart(hitbox, overlapParams)) do currentParts[part] = true local previousParts = TouchingParts[ballModel] if previousParts and not previousParts[part] then onHitboxTouched(ballModel, part) end end TouchingParts[ballModel] = currentParts end end) MainTab:CreateToggle({ Name = "Hitbox", CurrentValue = false, Flag = "Hitbox", Callback = function(Value) if Value then enableHitboxes() else disableHitboxes() end end, }) MainTab:CreateSlider({ Name = "Hitbox", Range = {MIN_SIZE, MAX_SIZE}, Increment = 1, CurrentValue = HitboxSize, Flag = "Hitbox", Callback = function(Value) setHitboxSize(Value) end, }) Workspace.DescendantAdded:Connect(function(object) if isBall(object) then trackBall(object) end end) scanForBalls()