I've made a damage script for the kill parts in my obby,
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
human.Health = 0
end
end
script.Parent.Touched:connect(onTouched)
but I want to eliminate most of these scripts to make sure that my obby runs as fast as possible.
Is there a way to make one script that detects when any of the kill parts (they are all grouped) are touched and then deal 100 damage to the humanoid that touched it?
I've tried putting all of the parts as children under the script and changed the script to say:
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
human.Health = 0
end
end
script.Child.Touched:connect(onTouched)
but that didn't seem to work.

2 comments
ik this is probably a noob question, but i kinda new to programming
I don't think you are able to do that. An idea is to copy and paste the script on each brick.