Help making hitbox

Are you filtering anything right now?

Sorry I’m trying to do school and help at the same time :confused:

no what am i supposed to filter?

so are you still struggling with the problem of multiple damages?

Nothing, if you dont want to. However this means you do not need the 3rd parameter of the function. This being said,

local parts = workspace:GetPartsInBoundRadius(PartPosition ,Radius) 

Make sure to replace the two parameters with your values.

I had this problem as well and I fixed it yesterday

I used the table storing method, and it helped. So basically it’ll get the humanoid on the table and then skip it if it’s already in the table.

repeat task.wait()
        local HitTable = game.Workspace:GetPartsInPart(Part, Params)
        for i,v in ipairs(HitTable) do
            local Humanoid = v.Parent:FindFirstChildWhichIsA("Humanoid")
            if Humanoid ~= nil then
                if not table.find(HumTable, Humanoid) then
                    table.insert(HumTable, Humanoid)
                    self.Remote:FireServer(Humanoid.Parent)
                end
            end
        end
    until Destroy == true
1 Like

what does the remote event? aaaa

ignore the remote event, that’s my damage remote

It is used for client sided detection, but dont let that be of your concern yet.

Make sure the detection works fine first.

the only thing you need to focus on is this

if not table.find(HumTable, Humanoid) then
                    table.insert(HumTable, Humanoid)
                   --damage code
                end

Client side damage detection without any server checks is something you DEFINITELY want to stay away from, or else your game will be plagued with exploiters.

for me i’ve already done an anti cheat aka server check with the damage/hitbox spamming.

ok i got this to work but it still hits like a million times

I like to make my gun systems and weapons mostly server sided. All i do is fire a remote event to the server when they click (firing the gun) and handling the viewmodel. All the checks are server side. (Though I do have the same checks on the client too!)

Add a debounce table and check if the player is already in it, if not damage them, then insert them to the table and remove them maybe a second later, or however long you want!

local Params = OverlapParams.new()
    Params.FilterType = Enum.RaycastFilterType.Blacklist
    Params.FilterDescendantsInstances = {plr.Character}
    Params.MaxParts = 50

you should be doing a repeat until so you dont have a memory leak with while loop.

this is how the script looks like now

		local Debris = game:GetService("Debris")
		local humRP = player.Character.HumanoidRootPart
		local TweenS = game:GetService("TweenService")
		local damage = 12 * player.FLvl.Value
		local parts = workspace:GetPartBoundsInRadius(humRP.Position ,40) 
		for i,v in pairs(parts) do
			if v.Parent ~= player.Character and v.Parent:FindFirstChild("Humanoid") and v == v.Parent.HumanoidRootPart then
				v.Parent.Humanoid.Health -= damage
				local damageI = game:GetService("ReplicatedStorage").DmgIndicator:Clone()
				damageI.Parent = v.Parent.HumanoidRootPart
				damageI.TextLabel.Text = "-"..damage
				damageI.StudsOffset = Vector3.new(math.random(-2,2),math.random(-2,2),math.random(-2,2))
				local TweenDmg = TweenS:Create(damageI,TweenInfo.new(1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out, 0, false), {Size = UDim2.new(2,0,2,0)})
				TweenDmg:Play()
				TweenDmg.Completed:Connect(function()
					local TweenDmg2 = TweenS:Create(damageI,TweenInfo.new(1,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out, 0, false),{Size = UDim2.new(0,0,0,0)})
					TweenDmg2:Play()
				end)
			end
		end

I would connect to RunService.Heartbeat and then increment a delta variable once until it reaches something like 6, and then reset the delta and run the checks. Here, using 6 will run it 10 times a second at 60 FPS.