Part1 destroys part2 and not any other parts. How do i script this?

Hello!
I want to make a script but im having truble. I want to make a part1 destroys part2 and not any other parts. Im trying to make a lawn mower that only destroys the grass and not any other part.

Thank you for reading!

1 Like

If the grass is named something like “Grass” you can just do a simple name check

if partToDestroy.Name == "Grass" then
     dosomething()
end
2 Likes

Thank you so much for helping me! How do i place the script to make it work?


Screenshot_48

part.Touched:Connect(function(hit)
    if hit:IsA("Part") and hit.Name == "Grass" then -- remove IsA if u want
       hit:Destroy()
    end
end)
1 Like