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
 

Access an object using a value inside of a stringvalue?

Previous Thread :: Next Thread 
insanehog is not online. insanehog
Joined: 08 Jul 2012
Total Posts: 183
05 Dec 2014 06:33 PM
I have a StringValue which has a name of an object. So when I need to access a directory with whatever object's name is in the StringValue, how would I do that?

so example:

workspace.StringValue.script:remove()

"StringValue" is what is inside of StringValue.
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
05 Dec 2014 06:35 PM
workspace:findFirstChild(stringvalue.Value)?

also, you could just use an objectvalue instance instead
Report Abuse
insanehog is not online. insanehog
Joined: 08 Jul 2012
Total Posts: 183
05 Dec 2014 06:38 PM
Well wait no. In my script, whatever object's name is inside of String.Value, I want to use that when going through a directory.

For example:

3 objects:

car
bed
floor

String.Value = "car"

workspace.[String.Value].wheel
^

how would I do that
Report Abuse
Qivr is not online. Qivr
Joined: 22 Aug 2014
Total Posts: 5407
05 Dec 2014 06:39 PM
you need to express what you're trying to do better
maybe
local a = game.Workspace:findFirstChild(String.Value)

[Qivr] Hail Greenland!
Report Abuse
insanehog is not online. insanehog
Joined: 08 Jul 2012
Total Posts: 183
05 Dec 2014 06:42 PM
Sorry, it's just difficult to explain. But what you gave me works, but I remember doing it in just one line.

something like this:

game.Workspace[String.Value].Wheel
Report Abuse
FutureWebsiteOwner is not online. FutureWebsiteOwner
Joined: 29 Jul 2014
Total Posts: 468
05 Dec 2014 06:44 PM
o ik what ur asking...
ye i dont code that way so... im no help
Report Abuse
ImageLabel is not online. ImageLabel
Joined: 08 Dec 2012
Total Posts: 428
05 Dec 2014 07:02 PM
--stringValue = the value you are referring to
--product = "stringValue's" Value

local stringValue = workspace.Value
local product = stringValue.Value
print(unpack(workspace[product]:children()))

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