|
| 19 Nov 2011 02:55 PM |
why does this script only work once? This script is supposed to remove a players legs, and it works but only once a server. can anyone fix it so it works without stopping?
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then local ll = part.Parent:findFirstChild("Left Leg") local rl = part.Parent:findFirstChild("Right Leg") ll:remove() rl:remove() end end script.Parent.Touched:connect(onTouched)
Thank You!!!!! |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2011 03:05 PM |
because u hav e it set so it just finds the part if it exist, but nothing to make it contnue if th epart doesn't exist.
I think ? |
|
|
| Report Abuse |
|
|
| |
|
zazw3
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1238 |
|
|
| 19 Nov 2011 03:55 PM |
@last I see the logic but it no worky like that,
Ima stab in teh dark a bit here but, use the other meathod of connecting and see if that works, Ive been having problems connecting it like that :/ |
|
|
| Report Abuse |
|
|
MattJon
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 660 |
|
|
| 19 Nov 2011 04:32 PM |
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then local ll = part.Parent:findFirstChild("Left Leg") local rl = part.Parent:findFirstChild("Right Leg") if ll = nil then ll:remove() if rl ~= nil then rl:remove() end end end end script.Parent.Touched:connect(onTouched)
--------------------------- Try that |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2011 05:24 PM |
Try this:
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if (h~=nil) then local ll = part.Parent:findFirstChild("Left Leg") local rl = part.Parent:findFirstChild("Right Leg") ll:Remove () rl:Remove () end end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
Lowcart
|
  |
| Joined: 12 Sep 2011 |
| Total Posts: 1323 |
|
| |
|
|
| 19 Nov 2011 05:30 PM |
Try this instead:
function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if (h~=nil) then local ll = part.Parent:findFirstChild("Left Leg") local rl = part.Parent:findFirstChild("Right Leg") if (ll ~= nil) and (rl ~= nil) then ll:Remove () rl:Remove () end end end script.Parent.Touched:connect(onTouched)
|
|
|
| Report Abuse |
|
|
sharky99
|
  |
| Joined: 18 Dec 2008 |
| Total Posts: 3364 |
|
|
| 19 Nov 2011 06:30 PM |
script.Parent.Touched:connect(function (t) local h = t.Parent:findFirstChild("Humanoid") if h then if (h.Parent:findFirstChild("Right Leg")) then if (h.Parent:findFirstChild("Left Leg")) then h.Parent:findFirstChild("Right Leg"):remove()h.Parent:findFirstChild("Left Leg"):remove() end end end end)
---------------------------------------------------------- --[[
Try that ~Sharky99
]]
|
|
|
| Report Abuse |
|
|
|
| 19 Nov 2011 06:40 PM |
| Thank you so much for all the help guys! I used the script bob posted (the second one) and it worked perfectly. Thanks!!!! |
|
|
| Report Abuse |
|
|
sharky99
|
  |
| Joined: 18 Dec 2008 |
| Total Posts: 3364 |
|
|
| 19 Nov 2011 06:52 PM |
Theboss
see if mine worked :3 |
|
|
| Report Abuse |
|
|