How to make a part that destroys itself when it touches another part

Hi developers! I am working on a puzzle game where you have to put a part on a button which then opens a door like in Portal. I want to make it so that players are not able to bring blocks from other levels into the next level. Is anyone able to tell me how I can do it? Thanks.

You can use the .Touched event listener!

It would look something like this:

-- assuming the script is in the part that gets destroyed
script.Parent.Touched:Connect(function(touchingPart)
    if touchingPart == game.Workspace.ButtonPart then
        script.Parent:Destroy()
    end
end)
2 Likes

It worked!
(30 charactersssss)

2 Likes