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: Can you create a variable when the object doesn't exist?

Previous Thread :: Next Thread 
MaleficusFreud is not online. MaleficusFreud
Joined: 15 Nov 2014
Total Posts: 1560
19 Dec 2016 05:51 PM
ex: local p1 = game.Workspace.Point1

before Point1 exists.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
19 Dec 2016 05:53 PM
you can just have:

local p1
p1 = game.Workspace.Point1

p1 will be nil until you assign its value to Point1
Report Abuse
MaleficusFreud is not online. MaleficusFreud
Joined: 15 Nov 2014
Total Posts: 1560
19 Dec 2016 05:56 PM
thanks
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
19 Dec 2016 06:01 PM
that would error if it didn't exist.

You would need:

p1 = game.Workspace:WaitForChild("Part1")
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
19 Dec 2016 07:28 PM
That's pretty much what I said. A declared variable is nil unless it is initialized.
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
19 Dec 2016 08:18 PM
yes but if he tried to use the variable and it hasn't been made, his script will break
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