I want my script to work if the brick is touched by an explosion but so far, what I have does not work.
health = script.Parent.Parent.Parent.Health
local debounce = false
function onHit(toucher)
if debounce == false then
debounce = true
if toucher.Name == "Explosion" then
health.Value = health.Value - 10
print (health.Value)
wait(3)
debounce = false
script.Parent:Destroy()
end
end
end
script.Parent.Touched:connect(onHit)
It will work if there is another brick or physical object called "Explosion" touching this brick, but not an actual instance of an explosion. Why is that, too?

1 comment
The explosion object can’t be touched, but it can touch.