Weapon Damage Problem

Im using a combo script to send the attack streak from a local script to a server script and play the proper attack animation while also doing damage to the player the blade touches. The problem is when more than one signal is sent to the script, it doesn’t properly finish the damage function.

Combo Sending Function (Local Script):

local function Attack()
	for _,weapon in pairs(righthand:GetChildren()) do
		if weapon:FindFirstChild("Handle") then
			local swordtype = weapon:FindFirstChildOfClass("StringValue")
			print("sent")
			
			ComboSender:FireServer(swordtype, weapon, Streak, Mouse.Hit) -- Streak increases the more you attack before combo timer resets
			
			end
		end
	end

Streak Receiver (Server Script):

	---- Streak Handler ----
		if Streak == 1 then
				
				ATK1:Play()
				DoDamage(weapon, Mouse)
			
		elseif Streak == 2 then
			
				ATK2:Play()
				DoDamage(weapon, Mouse)
				
		elseif Streak == 3 then
				
			wait(.2)			
				ATK3:Play()
				DoDamage(weapon, Mouse)
				
		elseif Streak == 4 then
				
			wait(.2)
				ATK4:Play()
				DoDamage(weapon, Mouse)
				
		elseif Streak == 5 then
				
			wait(.5)
				ATK5:Play()
				DoDamage(weapon, Mouse)
			Attacking.Value = false
				
		end

Damage Function (Server Script):

function DoDamage(weapon, Mouse)
	
	local Blade = weapon:FindFirstChild("Blade")
	
	---- DMG Amount ----
	local MinDMG = weapon:FindFirstChild("MinDMG")
	local MaxDMG = weapon:FindFirstChild("MaxDMG")
	local AtkDMG = math.floor(math.random(MinDMG.Value,MaxDMG.Value))
	
	---- Face Attack Direction ----
	local ATKGyro = Instance.new("BodyGyro")
	ATKGyro.Parent = char.HumanoidRootPart
	ATKGyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
	ATKGyro.D = 100
	ATKGyro.P = 10000
	ATKGyro.CFrame = CFrame.new(Vector3.new(0, 0, 0), Mouse.LookVector * Vector3.new(1, 0, 1))
	debris:AddItem(ATKGyro,.1)
	
	---- Do Damage ----
	local CanDamage = true
	Blade.Touched:Connect(function(part)
		if CanDamage then
			CanDamage = false
			
		local Target = part.Parent:FindFirstChild("Humanoid")
		
			if Target then
				
			print("fighting")
				Target:TakeDamage(AtkDMG)
				
			end
		end
		end)
	end

Video:

As you can see, the blade does damage even after nothing is touched, this happens when the attack button is pressed rapidly more than once.

I can provide more code if needed :pray:

One main problem you’re having right now is the script never gets removed or inserted into the blade. I see the way you are trying to do your attack system but I would suggest making a script that import the damage script into the blade then removes it. Unless you are using tools?

So should I only put the damage function into it or should I put the entire server script including the Streak into it?

Well I’m not going to tell you what to do but I would suggest yes use import only the damage script into the sword and make the local script sense after the attack was completed to destroy the script. But make sure you have a clone in the script.

For example DamageFunction:Clone().Parent = Blade ← Example Only