I am working on a conveyor belt with parts and I placed a big brick so the part touches the brick, what script do I put to make the brick destroy the item that touches it?
This is for a tycoon.
What I want to happen: Items: Conveyor Belt, Part, Brick. What happens: Parts are on Conveyor belt, once part touches brick, the part disappear, (gets removed from Workspace).
All you need is a simple 'Touched()' event to get this working. You should also note however that whenever you used this event, at least one of the parts has to be UNanchored.
Here's how you would do it:
script.Parent.Touched:connect(function(Part) --Fires the function when brick is touched Part:remove() --Removes the part end)
This is really all you need for that. It's pretty simple to do, just like I said.
So anyways, if you have any further problems/questions please leave a comment below, and I'll see what I can do. Hope I helped :P
Late answer, but if you want to find out what part touches it, this is what I would do:
function Touched(otherPart) if otherPart.Name == "Part that removes it" then otherPart:Destroy() end end script.Parent.Touched:connect(Touched)
WHAT THE HELL I AM SUCH AN IDIOT ON PUTTING IT TO DESTROY THE PARENT OF THE SCRIPT D: