This script is supposed to make the person that shot it take 8 damage, unfortunately that only happens if you step on it! Why doesn't it work if you shoot it?
Part12 = script.Parent function Hit(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human ~= nil then human.Health = human.Health -8 end end Part12.Touched:connect(Hit)
Please help!!! Thank you!
-This is not my script-
The Touched
event triggers when the geometrical representation of an instance that inherits from BasePart
intersects that of another. When A intersects with B, A and B both fire a Touched
event.
The script that you posted will only work in these circumstances:
The weapon fires physical (BasePart
inheriting) projectiles
The projectiles that are fired are parented to the character Model
of the Player
If you parent the projectiles to the character Model
of the Player
, this script will work.
If your weapon does not use physical projectiles, but rather another method (such as ray casting) then your script will not work because the Touched
event does not fire when detected by a ray.