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

How do I make this script only destroy parts if it has one of multiple names?

Asked by 4 years ago
function onTouched(hit)



hit:Destroy()



end







connection = script.Parent.Touched:connect(onTouched)

1 answer

Log in to vote
0
Answered by 4 years ago

You need to use the if command

function onTouched(hit) 02 if hit.name == "Custom name here" or hit.name == "Custom name here" then 03
04
05 hit:Destroy() 06
07
08 end 09 end

Ad

Answer this question