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 11 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
11 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.

1local part = script.Parent
2 
3part.Touched:connect(function(hit)
4print(hit..' has touched this brick!')
5part:Destroy()
6end)

if you want per say a specific type of brick:

1local part = script.Parent
2 
3part.Touched:connect(function(hit)
4    if (hit.Name == "Lava") then
5        part:Destroy()
6    end
7end)
Ad

Answer this question