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 » Scripters
Home Search
 

Re: How do I check to see if something is NOT there

Previous Thread :: Next Thread 
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
28 Jul 2016 12:06 PM
while wait() do
if script.Parent["Left Arm"] == nil then
script.Parent.Humanoid.Health = 0
end
end

It's suppose to be if there is no left arm, then health = 0
Report Abuse
FireFruit226 is not online. FireFruit226
Joined: 03 Jun 2015
Total Posts: 497
28 Jul 2016 12:09 PM
The more loops you have working in a game, the laggier it will be. Try creating a function that fires when a child is removed from the parent.

Model = script.Parent

Model.ChildRemoved:connect(function()
if script.Parent:FindFirstChild('Left Arm') ~= true then
script.Parent.Humanoid.Health = 0
end
end)
Report Abuse
SirIngenuity is not online. SirIngenuity
Joined: 06 Oct 2012
Total Posts: 3149
28 Jul 2016 12:29 PM
Thanks ^,

Also I have a lot of loops in the game and there really stupid, should I consider changing them to Changed:Functions?
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
28 Jul 2016 12:30 PM
I usually use object:FindFirstChild("asdf") ~= nil but I guess that works too!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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