hamburger="hummanoid" myFunction = "part" script.Parent.Touched:connect(function(hamburger) if hamburger.Parent.FindFirstChild.myFunction then hamburger.parent.Head:Destroy() end end)
-- This script destroys player head --Its really wrong --Please help me fix it .
Your code makes no sense at all, try this.
function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human == nil) then return end -- if it is not a humanoid, then do nothing, otherwise... human.Health = 0 -- then kill the humanoid end script.Parent.Touched:connect(onTouch)