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

Touched Event Broken?

Asked by
anerth 25
8 years ago

I have some code that i am using inside of a fast-moving bullet. I clone this script into the bullet when the player fires the gun, and when it touches something it is supposed to hurt it IF it has a humanoid. I am just testing with the print function but it doesn't want to print at all. I have a fear that the Touched event is broken. I have checked the ROBLOX forums, but the only answer I can find is removing something that I don't even have.

function OnTouched(hit)
    print("touch!")
    --local human = hit.Parent.Humanoid
    --human.Health = human.Health - 6
    --script.Parent.Parent = nil
end
wait(0.1)
script.Parent.Touched:connect(OnTouched)

EDIT: The same script will work in another block. Is it because the Disabled value is set to true when I insert it into the part?

Answer this question