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

How can I make this function delete Anchored Bricks?

I have a function that is suppose to remove bricks when it touches the brick with the function. How can I make it so the function will also delete anchored bricks?

Here's the script:

function onTouched(hit) 
if hit.Name == 'BuildingBrick' then
hit:Destroy()
end
end
script.Parent.Touched:connect(onTouched) 

1 answer

✓ Accepted answer

Just check for the Anchored property.

function onTouched(hit) 
if hit.Name == 'BuildingBrick' or hit.Anchored then -- also check if Anchored is true
hit:Destroy()
end
end
script.Parent.Touched:connect(onTouched) 

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