of     1   

DesterDasqwe
#183000082Thursday, February 04, 2016 9:36 PM GMT

Can somebody help me? I'm making a script that destroys a part when it touches something named "Drill". But it doesn't work. I'm pretty sure something is wrong but I cant tell what, please help! thanks. The script: local stone = script.Parent function OnCollide(part) if part.Name("Drill") stone.Destroy() end end Thanks!
ez_street
#183003759Thursday, February 04, 2016 10:42 PM GMT

script.Parent.Touched:connect(function(hit) if hit.Name == "Drill" then script.Parent:Destroy() end end
ez_street
#183003895Thursday, February 04, 2016 10:44 PM GMT

There were a couple problems: 1. You didn't add a "then" on the if part.Name line. 2. You did part.Name("Drill"), it should be part.Name == "Drill" 3. You did stone.Destroy, it should be stone:Destroy() with a colon. 4. The entire thing wouldn't work anyways because you didn't call the function with an event (stone.Touched:connect(OnCollide)).
DesterDasqwe
#183013427Friday, February 05, 2016 1:11 AM GMT

ok thanks! I'm not that good at scripting so I knew there would be lots of mistakes!

    of     1