I have a script meant to be able to damage multiple enemies in once slice, but no more than once. Sadly, it has trouble detecting for hits sometimes, and I have no idea why. Could it be that I have filteringenabled on and I'm playing the animations clientside?

The actual code for those wondering: (please excuse me if I missed some ends, I only took the part that was important and patched it up)


local Blade = Tool.Blade.Touched:connect(function(hit)
		
		if hit then

		if hit.Name == "Blade" then
			Sounds.Clash:Play()
			return
		end
		
		local ehum = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
		
		if ehum and ehum ~= hum then
			
			Success = true
			
			for i,v in pairs(doNotHit) do
				if v == ehum then
					Success = false
					break
				end
			end
			
			if Success ~= false then --Success, ehum has not already been damaged
			ehum:TakeDamage(40)
			end
		end
	end
end)

4 comments

0

Yes its kind of the problem that its only on client side and not server side

0

If I go on the server tab, the animation plays fine.

0

What's inside doNotHit

0

it's a blank array that refreshes every time you swing