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

How do I make this only remove parts or bricks?

Asked by
EpicLilC 150
8 years ago

So recently, I asked a question on how to make a PartRemover and I got this..

function removebricks(PartThatTouched)
    PartThatTouched:Destroy()
end
game.Workspace.PartDeleter.Touched:connect(removebricks)

which does WORK, but it still kills me, and I only want this thing to remove parts from workspace, not players. How would I do that?

2 answers

Log in to vote
0
Answered by
Kryddan 261 Moderation Voter
8 years ago
function removebricks(PartThatTouched)
    if PartThatTouched:IsA("BasePart") and GetPlayerFromCharacter(PartThatTouched.Parent) == nil then
        PartThatTouched:Destroy()
    end
end
game.Workspace.PartDeleter.Touched:connect(removebricks)

Ad
Log in to vote
0
Answered by 8 years ago

If you are typing out a script that you want to destroy and only destroy the part, then use this script:

game.Workspace.Part:Destroy() ---------- Part can be replaced with anything you are trying to destroy.

Answer this question