So basically heres how it works, it invokes the server when you press the punch key, and the server side script clones a dmg script inside it into the players Left hand,
J = false local PlayerWhoPunched = script.Parent.Parent.Name local LHand = script.Parent local hurt = script.DMG LHand.Touched:connect(function(Part) if J == false then J = true if Part.Parent:FindFirstChild("Humanoid") then local Human = Part.Parent:FindFirstChild("Humanoid") Human.Health = Human.Health - hurt.Value end end end)
Now it works perfectly sometimes but other times it just does not register the hit, is this because I do not have the script that does the dmg itself disabled before its cloned? Or could it be because of my animation? Because I swear I have landed so many hits on the head just for them to not register
Well using part.Parent:FindFirstChild('Humanoid')... A good thing you can do to check this is to print what part.Parent name is.
There is a possibility you're hitting an accoutrement (Hat, Wings, etc) or a Tool which would make its part.Parent the accoutrement or a tool. Therefore you would never find a Humanoid within it. (And if you do, it's probably not the 'Humanoid' you're looking for lol)
Not sure if this is the 'Best' solution but what I have done before is taken the part that's been hit and check for part.Parent:FindFirstChild('Humanoid') or part.Parent.Parent:FindFirstChild('Humanoid')
I'm sure there are many other ways (More efficient) but I've used this and it's worked for me. Give it a shot and let me know.