I'm making a cannon for my game. It's not sensing that the player is touching it. Why is that so? code:
function touch(hit)
if hit.Name == "Part" then
script.Parent.Humanoid.Health = script.Parent.Humanoid.Health - 25
print("changed health")
end
end
script.Parent.UpperTorso.Touched:Connect(touch)
The code is in game.StarterPlayer.StarterCharacterScripts

5 comments
u should put it in workspace and u also need to find the child before you can damage it
Is this a local script?
"script.Parent.Humanid"... not the character touching it... the character touching it wont be affected..???
no local script
i actually meant the cannon shoot