My hitbox will only damage me + the combat continues even once I'm dead

At the moment, my hitbox finally works after all this time, I decided to scrap the RotatedRegion3 module for a small amount of time and build my knowledge on regular Region3 allowing me to make an actual working hitbox, but there were a few issues. When I did a hit, I’d instead only get damaged, and at death the issue would be AnimationProvider would bug out.

image

At the same time the combat would play even you are dead.

That dummy will need to be compatible with how you’re dealing damage. You’ll also need to exclude the BasePart instances of the player’s character which created the damage box.

How would I exclude the Player’s Character?

Make a function to detect when he dies and make it destroy the hitbox/combat instance you using to deal damage

plr.Character.Humanoid.HealthChanged:Connect(function()
 for i,v in next,plr.Character:GetDescendants() do
    if v:IsA('Part') and v.Name=='HitboxDmg' then
        v:Destroy()
    end
 end
end)

Some like that

I’ll test this right now, but the issue I seem to have as well is the AnimationProvider stopping the combat completely, once I respawn for some odd reason. Do you know anything about that possibly?

It just stop when you reset? Also where this script at?

These scripts are inside the starterpack and once I respawn it’ll just abruptly not work no matter how much I click. I have a similar issue with my fireball where once you respawn the same thing will happen, but the function will still work.

Try add a wait(1) above the script to wait the character load

Ah, that’s fixed now. So, it’s time to test out the healthchanged function and make needed edits.

1 Like

Might I ask what is HitboxDmg meant to be? Is it meant to be the actual hitbox? Or something else

I actually dont know what you using to deal damage, its just a example of what you need to do, basically remove the instance thats deal the damage when the ply die

Currently I’m using Region3

if Action == ("Combat") then 
		local HitBox = HiBo:Clone()
		HitBox.CFrame = Character.PrimaryPart.CFrame * CFrame.new(0, 0, -3)
		local Welds = Instance.new("WeldConstraint", Character.PrimaryPart)
		Welds.Part0 = HitBox
		Welds.Part1 = Character.PrimaryPart
		HitBox.Parent = workspace
		local pos1 = HitBox.Position - (HitBox.Size/2)
		local pos2 = HitBox.Position + (HitBox.Size/2)
		local Re3 = Region3.new(pos1, pos2)
		
		local HBFinder = workspace:FindPartsInRegion3(Re3, HitBox, 20)
		Debris:AddItem(HitBox, 0.3)
		for i, parts in pairs (HBFinder)  do
			if parts.Parent:FindFirstChild("Humanoid") and parts.Parent ~= Character then
				print(parts.Name)
			elseif parts.Parent == nil then
				return parts
			end
		end
		
		if HBFinder.Name == Character.HumanoidRootPart and HBFinder.Name ~= Character then
			return HBFinder.Name 
		elseif HBFinder.Name == HumanoidRootPart or HRP then
			Humanoid:TakeDamage(5)	
		end

Something like that.

Ye,just remove it when you die,make it parent of the player or disable the script
3 solutions for this

I recommend the first one

Remove it then bring it back when they respawn? How would I do that? Moving the script or just deleting it and making a copy?

Check when you respawn it create a new one at workspace, if yes them just delete it,
else if not you need recreate it

Ah, alright I’ll try that right now.

I tried doing something like this

Player.Character.Humanoid.HealthChanged:Connect(function()
			for i,v in next,Player.Character:GetDescendants() do
				if v:IsA('Part') and v.Name =='CombatR3' and Player.Character.Humanoid.Health > 0 then
				local Combatr33 = v.Name["CombatR3"]:Clone()
					Combatr33.Parent = workspace
					v:Destroy()
				end

Although it does absolutely nothing for some odd reason. Not even delete the script if I’m dead.

Used my brain a little and used the Died Function. Basically, I checked if the Humanoid died and just Disabled the main script/combat script until the character respawned.