Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you help me modify my Part remover script?

Asked by 9 years ago

I have this script to remove parts:

script.Parent.Touched:connect(function(hit)
    hit:Remove()

end)

This does what it needs to because It deletes the parts it touches but I am making a tycoon. I am trying to make it to where it removes the part depending on its name like If the parts name is Part22 then it will remove Part22 not Part. This is so that I can make it to where when the parts fly out of the tycoon they dont sit around and lag. Please help, I have not been able to find away to do this!

By, TixyScripter

1 answer

Log in to vote
1
Answered by 9 years ago
script.Parent.Touched:connect(function(hit)
if hit.name == "Part22" then --Or whatever...
hit:remove()
end
end)

Here you go.

The below script if for removing multiple parts so you don't need 30 scripts in one part.

script.Parent.Touched:connect(function(hit)
if hit.name == "Part22" or "INSERT PART NAME HERE" then
hit:remove()
end
end)
0
If I want it to delete more than two can I keep putting or, or jsut a comma TixyScripter 115 — 9y
0
I don't think commas work. BTW please Accept My answer? EzraNehemiah_TF2 3552 — 9y
Ad

Answer this question