Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with my hit detection? It only likes to trigger half the time...

Asked by 6 years ago

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)
0
Yes its kind of the problem that its only on client side and not server side Lualaxy 78 — 6y
0
If I go on the server tab, the animation plays fine. Professor_Boxtrot 136 — 6y
0
What's inside doNotHit lesliesoon 86 — 6y
0
it's a blank array that refreshes every time you swing Professor_Boxtrot 136 — 6y

Answer this question