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

How do I make a block delete itself?

Asked by 10 years ago

I would like to know if anyone has a script that makes a brick delete itself when it comes into contact with ANY another brick. It would be a great help, thanks ;)

1 answer

Log in to vote
2
Answered by
Dummiez 360 Moderation Voter
10 years ago

If you have the script inside the brick that deletes itself, in this case destroy then use the touched event.

This is if anything else touches it.

local part = script.Parent

part.Touched:connect(function(hit)
print(hit..' has touched this brick!')
part:Destroy()
end)

if you want per say a specific type of brick:

local part = script.Parent

part.Touched:connect(function(hit)
    if (hit.Name == "Lava") then
        part:Destroy()
    end
end)
Ad

Answer this question