Sorry for the repetitive questions, but I am working on learning by doing and I think that this is the best way to figure something out if I don't know the correct terminology to search.
script.Parent.Catch.Touched:connect(function(otherPart) print(otherPart) if otherPart == script.Parent.Parent.Parent.MoneyBricks then otherPart:Destroy() print ("Part deleted") end end)
In this script I'm trying to set a requirement for a block, if it's parent is "MoneyBricks" then it would be deleted, but this script doesn't work and I was curious for the correct way to go about doing this.
script.Parent.Catch.Touched:connect(function(otherPart) print(otherPart) if otherPart.Parent == script.Parent.Parent.Parent.MoneyBricks then otherPart:Destroy() print ("Part deleted") end end)
You were mostly correct, you want to check the Parent of otherPart and then remove it. Parent is a property of otherPart so you can just check if otherPart.Parent equals something.