Vupa
|
  |
| Joined: 07 Dec 2009 |
| Total Posts: 5637 |
|
|
| 11 Jul 2015 01:15 PM |
I made a brick wall that gets destroyed when you hit it with a sledgehammer tool. I want to make it so the bricks only get destroyed if you swing at them. The script I have right now allows the bricks to be destroyed even if you walk up to it and touch it with the sledgehammer. Heres what it looks like Model >Script >Brick >Brick and so on. the script is: for i, v in next, workspace.Model:GetChildren() do if v:IsA("BasePart") then v.Touched:connect(function(hit) if hit.Parent.Name == "Sledgehammer" then v:Destroy() end end) end end
how would I edit it to only be destroyed when you swing the sledgehammer?
|
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 01:29 PM |
Insert a boolvalue into the sledgehammer part, and have it's value enabled when you swing, and disabled after you swing, then have the script detect if it's value is true to break the wall.
~who's awesome? you're awesome! |
|
|
| Report Abuse |
|
|
Vupa
|
  |
| Joined: 07 Dec 2009 |
| Total Posts: 5637 |
|
|
| 12 Jul 2015 01:43 PM |
| err. could you put that in more simple terms? sorry. lol. |
|
|
| Report Abuse |
|
|