function onTouch(Part) Part.Parent:TakeDamage(4) end script.Parent.Touched:connect(onDamage)
Need more information. This is a simple script which searches for a Humanoid and then gives damage(with debounce).
local touched = false script.Parent.Touched:connect(function(part) if not touched then touched = true local humanoid = part.Parent:findFirstChild('Humanoid') if humanoid then humanoid:TakeDamage(4) end touched = false end end)
You messed up a bit by having the function named "onTouch" and having the .Touched:connect(onDamage). To fix this all you have to do is this:
function onTouch(Part) Part.Parent:TakeDamage(4) end script.Parent.Touched:connect(onTouch)
That should fix your script.