|
| 30 Aug 2013 04:27 AM |
I want it so that when the part is touched it will fall over.
larm = script.Parent:FindFirstChild("Left Arm") rarm = script.Parent:FindFirstChild("Right Arm") lleg = script.Parent:FindFirstChild("Left Leg") rleg = script.Parent:FindFirstChild("Right Leg")
function OnTouched(hit) if hit.Destroyable == true then hit.Anchored = false end end
script.Parent.Head.Touched:connect(OnTouched) larm.Touched:connect(OnTouched) rarm.Touched:connect(OnTouched) lleg.Touched:connect(OnTouched) rleg.Touched:connect(OnTouched) script.Parent.Torso.Touched:connect(OnTouched) |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 30 Aug 2013 04:57 AM |
I dont get this
for _, v in pairs (game.Players.LocalPlayer.Character:children()) do if v:IsA("Part") then v.Touched:connect(function(hit) if hit and hit.Name == "Destroyable" then hit.Anchored = false end end) end end |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2013 05:03 AM |
| Its because i have a giant zombie and i want it to knock parts over but only if they are marked as destroyable or else it would delete the base plate and other important things. But when it walks into the thing it just walks over it. |
|
|
| Report Abuse |
|
|
xxBsFxx
|
  |
| Joined: 26 Aug 2013 |
| Total Posts: 3281 |
|
| |
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 30 Aug 2013 06:11 AM |
^
Im aware of that, but why would I use GetChildren() when I can use :children(), besides the fact that its deprecated and will not likely be removed. (Not for a while anyways) |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2013 06:15 AM |
It is better to use GetChildren, because it is more efficient for newer work.
children() still works, but Sorcus was talking about removing deprecated items in the near future. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 30 Aug 2013 06:18 AM |
| Im doing fine with it. I refuse into typing more until I learn my lesson. |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2013 06:22 AM |
| My typing is fast enough for me not to notice 3 extra key presses. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|