I have a function which is suppose to delete a specific named brick if it touches the brick which contains the script, But it deletes all bricks containing that name in the workspace and I just need the function to delete the one brick that touched it. Please help!
Here's the script:
function onTouched()
c = game.Workspace:GetChildren()
for i = 1, #c do
if c[i].Name == "BuildingBrick" then c[i].Parent = nil end -- How can I make it so it will only delete the brick that touched it and not all bricks named "BuildingBrick"
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Thanks!