Not Damaging Player

So I have this part that I want to damage players with, however it isn’t. No errors and it only prints “1”. Can anybody figure out whats wrong?

explotouch = Explosion.Touched:Connect(function(hit)
		print("1")
		local e_Hm = hit.Parent:FindFirstChild("Humanoid")
		if e_Hm and e_Hm.Health > 0 and e_Hm ~= character:WaitForChild("Humanoid") and not hit.Parent:FindFirstChild("tag") then
			print("2")
			CanAttack = false
			print("3")
			debounce = true
			print("4")
			local EHumanoid = hit.Parent:FindFirstChild("Humanoid")
			print("5")
			EHumanoid:TakeDamage(10)
			print("6")
			local tag = Instance.new("StringValue")
			tag.Name = "tag"
			tag.Parent = hit.Parent
			Debris:AddItem(tag,.1)
			explotouch:Disconnect()
			debounce = false
			CanAttack = true
		end
	end)

Is this a custom Character or no?

1 Like

Nope, it is not, it is the default.

1 Like

Hmm, can you show the whole script?

2 Likes
remotes.Skill2.OnServerEvent:Connect(function(player)
	local character = player.Character
	local rp = character.HumanoidRootPart
	
	local Explosion = game.ReplicatedStorage.Sword:WaitForChild("Explosion"):Clone()
	local Track = player.Character.Humanoid:LoadAnimation(AnimationsFolder.Skill2)
	Track:Play()
	
	local debounce = false
	handletouch = tool.Handle.Touched:Connect(function(hit)
		local e_Hm = hit.Parent:FindFirstChild("Humanoid")
		if e_Hm and e_Hm.Health > 0 and e_Hm ~= character:WaitForChild("Humanoid") and not hit.Parent:FindFirstChild("tag") then
			debounce = true
			CanAttack = false
			local EHumanoid = hit.Parent:FindFirstChild("Humanoid")
			EHumanoid:TakeDamage(10)
			local tag = Instance.new("StringValue")
			tag.Name = "tag"
			tag.Parent = hit.Parent
			Debris:AddItem(tag,.2)
			handletouch:Disconnect()
			debounce = false
			CanAttack = true
		end
	end)
	
	Track.Stopped:Connect(function()
		Explosion.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0,-2,0)
		Explosion.Parent = workspace
		local goal = {
			Size = Explosion.Size * 10
		}
		local info10 = TweenInfo.new(1.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
		local spin = tweenservice:Create(Explosion,info10,{CFrame = Explosion.CFrame * CFrame.Angles(0,math.rad(120),0)})
		local enlarge = tweenservice:Create(Explosion,info10,goal)
		spin:Play()
		enlarge:Play()
		game.Debris:AddItem(Explosion,2)
	end)
	
	local debounce = false
	explotouch = Explosion.Touched:Connect(function(hit)
		print("1")
		local e_Hm = hit.Parent:FindFirstChild("Humanoid")
		if e_Hm and e_Hm.Health > 0 and e_Hm ~= character:WaitForChild("Humanoid") and not hit.Parent:FindFirstChild("tag") then
			print("2")
			CanAttack = false
			print("3")
			debounce = true
			print("4")
			local EHumanoid = hit.Parent:FindFirstChild("Humanoid")
			print("5")
			EHumanoid:TakeDamage(10)
			print("6")
			local tag = Instance.new("StringValue")
			tag.Name = "tag"
			tag.Parent = hit.Parent
			Debris:AddItem(tag,.1)
			explotouch:Disconnect()
			debounce = false
			CanAttack = true
		end
	end)
end)
1 Like

So i want you to find the hit part and print the value because the handle might be a Assesory

1 Like

Is the Explosion thing is a part?

1 Like

It is not a part it is a mesh.

1 Like

This is maybe the reason becuase it might be wrong( i says this because of this local e_Hm = hit.Parent:FindFirstChild("Humanoid") and so may not be the humanoid and so it just stops)

1 Like

I just did

print(hit.Parent)

and only the player who casts the ability prints

1 Like

wait nevermind the enemy prints as well

1 Like

if e_Hm and e_Hm.Health > 0 and e_Hm ~= character:WaitForChild("Humanoid") try removing not hit.Parent:FindFirstChild("tag")

1 Like

Yes i Agree with @AvaxDev this might fix your problem

1 Like

um idk what i did, but it works now.

2 Likes

Alright have a good day and happy thanksgiving!

1 Like