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

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

Asked by 7 years ago

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

Log in to vote
1
Answered by
mraznboy1 194
7 years ago

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
0
The problem is that the punch wouldnt register Any damage 1000anton 38 — 7y
0
What do you mean? It will deal damage as long as the caster is not the one who is being hit. mraznboy1 194 — 7y
0
IT would be like a punch that doesnt make Any damage 1000anton 38 — 7y
Ad

Answer this question