#How do I make hitboxes not spam hit and instead hits after the player leaves the hitbox and re-enter

1 messages · Page 1 of 1 (latest)

inner geode
#

sorry if its explained odd but im using GetPartBoundsInBox for my hitboxes and I can't find the inbetween of either being hit once or spam hit, aka how do I remove the hitboxPart from the paramaters after it has exited? I am new to using this so im not really sure

#
local size = Vector3.new(21.475, 1, 9.435)

local HitboxPart = Instance.new("Part")
HitboxPart.Anchored = true
HitboxPart.CanQuery = false
HitboxPart.CanCollide = false
HitboxPart.CFrame = CFpos
HitboxPart.Transparency = 0.5
HitboxPart.Size = size
HitboxPart.Parent = workspace

local params = OverlapParams.new(workspace.TestWall)
params.FilterDescendantsInstances = {workspace.TestWall}

while task.wait() do

    local parts = workspace:GetPartBoundsInBox(CFpos, size, params)
    
    local Hit = {}
    
    for i, part in pairs(parts) do
    
        if part.Parent:WaitForChild("Humanoid", 0.1) or part.Parent.Parent:WaitForChild("Humanoid") then
        
            if part.Name == "visibleHitbox" and not table.find(Hit, part.Parent) then 
    
            local char = part.Parent
            print(char)
            table.insert(Hit, char)
            params:AddToFilter(Hit)
            end
        
        end
    end


end```