I'm an early scripter, but i wanted to know how you could detect a player touch using scripts. I'm making a game with ghosts in which chase you, and when touched, they die and respawn. The problem is that I include other NPCs in my game which also trigger the script. Here is the script i am using...
ghost = script.Parent.Parent
function onTouched(hit)
local b = hit.Parent:FindFirstChild("Humanoid")
if b ~= nil then
ghost.Humanoid.Health = 0
end
end
script.Parent.Touched:connect(onTouched)
Also, the script being used is contained insided each humanoid 'LeftArm','UpperperTorso', 'Head' etc.
Any ideas on how to fix this?

1 comment
umm... the script is still activated by NPCs, what do i do?