Hello, so i have a script where when a tool is touched with a part that the part will be destroyed, but I also want the tool that touches to be destroyed as well. If someone could help that would be greatly appreciated! Script:
1 | script.Parent.Touched:Connect( function (p) |
2 | if p.Parent.Name = = "Sandbag" then |
3 | script.Parent:Destroy() |
4 | end |
5 | end ) |
Basically I just want to add onto that script
1 | script.Parent.Touched:Connect( function (p) |
2 | if p.Parent.Name = = "Sandbag" then -- Checks if the part's parent that was touched by the tool, is named "SandBag" |
3 | p.Parent:Destroy() -- Destroy the touched part's parent |
4 | script.Parent:Destroy() -- Destroy the tool along with it |
5 | end |
6 | end ) |
You can just use the Touched event's parameter, to destroy the part
You can look at this if you need to, https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched