Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Im trying to make a punch tool... why Does the caster of the punch recive damage?

So i currently use the touched event during an animation, using hit(first parameter of touch event) is how i deliver the damage but sometimes hit.parent is the caster of the punch making the player who punched take damage. Can i somehow prevent this? Sorry for no script

1 answer

You can pass the caster as another parameter to the script, then check if the hit.parent is the same as the caster you passed as the paramater.


function dealDamage(hit, caster)
	if (hit.Parent ~= caster) then
		--damage
	end
end

3 comments

0

The problem is that the punch wouldnt register Any damage

0

What do you mean? It will deal damage as long as the caster is not the one who is being hit.

0

IT would be like a punch that doesnt make Any damage

This discussion is preserved as it was. New answers, comments, and votes are closed.