Blade still dealing damage by colliding even when it's not activated

Hello there fellow developers. So today I had a minor problem with this sword script that I’ve made.
Whenever after I activate the sword to make it slash the victim, when the blade touch any Humanoid figures - it automatically dealing damage to the victim despite it’s not activated yet.

I want it to only damage the Humanoid when it’s activated not just damage immediately when it collided with any Humanoid parts.

I tried many solution such as making a Debounce variable to check if the variable is false then the variable will set to true and it will do the following script and set to false again. (I thought it will prevent the Blade from making damage by touching not just activated.)
Any helps will be appreciated! Thanks!

This is Local Script (placing in the sword tool):

-- [Main Variables] --
local Tool = script.Parent
local Debounce = false

-- [Services] -- 
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:FindFirstChild("Slash")

-- [Events] --

Tool.Equipped:Connect(function()
	Tool.Activated:Connect(function()
		if Debounce then return end Debounce = not Debounce
		Debounce = true
		RemoteEvent:FireServer("Slash")
		wait(.75)
		Debounce = false
	end)
end)

This is normal Script (placing in ServerScriptService):

-- [Main Variables] --
local Combo = 1
local CriticChance = math.round(100/15)

-- [Services] -- 
local RemoteEvent = game:GetService("ReplicatedStorage"):FindFirstChild("Slash")

-- [Events] --

RemoteEvent.OnServerEvent:Connect(function(Player, Value)
	local Character = game.Workspace:WaitForChild(Player.Name)
	if Value == "Slash" then
		local slashsound = Instance.new("Sound", Character)
		slashsound.SoundId = "rbxassetid://4958430453"
		if Combo == 1 then
		    local slash1 = Instance.new("Animation", Character)
		    slash1.Name = "Combo1"
		    slash1.AnimationId = "rbxassetid://6800350268"
			
		    local loadcombo1 = Character:WaitForChild("Humanoid"):LoadAnimation(slash1)
			loadcombo1:Play()
			slashsound:Play()
		    Combo = 2
		elseif Combo == 2 then
			local slash2 = Instance.new("Animation", Character)
			slash2.Name = "Combo2"
			slash2.AnimationId = "rbxassetid://6800655573"

			local loadcombo2 = Character:WaitForChild("Humanoid"):LoadAnimation(slash2)
			loadcombo2:Play()
			slashsound:Play()
			Combo = 3
		elseif Combo == 3 then
			local slash3 = Instance.new("Animation", Character)
			slash3.Name = "Combo3"
			slash3.AnimationId = "rbxassetid://6800679632"

			local loadcombo3 = Character:WaitForChild("Humanoid"):LoadAnimation(slash3)
			loadcombo3:Play()
			slashsound:Play()
			Combo = 1
		end	
	
		local FindSword = Character:FindFirstChild("Sword")
		if FindSword then
			FindSword.Blade.Touched:Connect(function(hit)
				if hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent ~= Character then
					local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
					if Humanoid.Parent.Name ~= Player.Name and Humanoid.Health > 0 and not hit.Parent:FindFirstChild("HitValue") then
						local hitsound = Instance.new("Sound", Humanoid)
						hitsound.SoundId = "rbxassetid://935843979"
						
						local k = Instance.new("IntValue", Humanoid.Parent)
						k.Name = "HitValue"
						game.Debris:AddItem(k, 1)
						if math.random(CriticChance) == 1 then
							print("Critical Hit!")
							Humanoid:TakeDamage(math.random(35, 52))
							hitsound:Play()
						else
							print("Normal Hit")
							Humanoid:TakeDamage(math.random(10, 15))
							hitsound:Play()
					    end
				    end
				end
		    end)
	    end
	end
end)
1 Like

You need to disconnect the .touched event after the strike is done, Or else the thing will fire whenever it touches something

3 Likes

Oh wow it worked, thank you for your help man.