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: If something ISN'T there, then do something?

Previous Thread :: Next Thread 
Knightofnight05 is not online. Knightofnight05
Joined: 03 May 2014
Total Posts: 345
04 May 2016 07:54 PM
I want to make a script that checks if something isn't present, and if it isn't the script will continue. How do I do that?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
04 May 2016 07:55 PM
Use the "not" operator with a conditional statement


Report Abuse
Dr_Doge is not online. Dr_Doge
Joined: 07 Dec 2011
Total Posts: 645
04 May 2016 07:56 PM
if not game.workspace.Part then
print'Parts not in workspace!' else print'Part IS in workspace!'
end
Report Abuse
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
04 May 2016 08:04 PM
^
That would error if part doesn't exist; use FindFirstChild:

if workspace:FindFirstChild("Part") then
--code here
end
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
04 May 2016 08:06 PM
forever, it would work fine.


Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
04 May 2016 08:07 PM
nvm, i didnt read how you said "if the part doesnt exist"


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