Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this only remove parts or bricks?

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

✓ Accepted answer
function removebricks(PartThatTouched)
	if PartThatTouched:IsA("BasePart") and GetPlayerFromCharacter(PartThatTouched.Parent) == nil then
		PartThatTouched:Destroy()
	end
end
game.Workspace.PartDeleter.Touched:connect(removebricks)

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.