Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Brick doesn't detect if it's being touched by an Explosion?

Asked by 5 years ago

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?

0
The explosion object can’t be touched, but it can touch. User#19524 175 — 5y

Answer this question