generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why Work Only Once?

Previous Thread :: Next Thread 
TheBoss2213 is not online. TheBoss2213
Joined: 17 Jun 2011
Total Posts: 100
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
textmasterthe9th is not online. textmasterthe9th
Joined: 03 Oct 2008
Total Posts: 752
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
TheBoss2213 is not online. TheBoss2213
Joined: 17 Jun 2011
Total Posts: 100
19 Nov 2011 03:53 PM
how do I change that?
Report Abuse
zazw3 is not online. 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 is not online. 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
Bob123456789103570 is not online. Bob123456789103570
Joined: 23 Dec 2008
Total Posts: 9531
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 is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
19 Nov 2011 05:26 PM
[ Content Deleted ]
Report Abuse
Bob123456789103570 is not online. Bob123456789103570
Joined: 23 Dec 2008
Total Posts: 9531
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 is not online. 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
TheBoss2213 is not online. TheBoss2213
Joined: 17 Jun 2011
Total Posts: 100
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 is not online. sharky99
Joined: 18 Dec 2008
Total Posts: 3364
19 Nov 2011 06:52 PM
Theboss

see if mine worked :3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image