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: game.Workspace[1]

Previous Thread :: Next Thread 
GhostAction is not online. GhostAction
Joined: 06 Aug 2014
Total Posts: 444
12 Oct 2016 03:31 PM
Can you not use brackets to get a specific item anymore?
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
12 Oct 2016 03:34 PM
workspace:GetChildren()[1]


~The Low Brass Master
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Oct 2016 03:35 PM
All of the items in the workspace should be keys of that userdata
Example = {
Part = "hi"
}

print(Example.Part)
print(Example[ 1])

getChildren however returns an array

workspace:getChildren()[1 ]
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
12 Oct 2016 03:35 PM
or if you had a part named 1 it would be workspace['1']


~The Low Brass Master
Report Abuse
GhostAction is not online. GhostAction
Joined: 06 Aug 2014
Total Posts: 444
12 Oct 2016 03:43 PM
GameObjects:FindFirstChild(Category)[math.random(1, #GameObjects:FindFirstChild(Category)

It's giving me a error in the editor
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Oct 2016 03:44 PM
1) use variables so you can read the code better
2) use getchildren to get an array of the children instead of the userdata of the whole object itself
Report Abuse
GhostAction is not online. GhostAction
Joined: 06 Aug 2014
Total Posts: 444
12 Oct 2016 03:45 PM
didn't paste bracket on the end
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
12 Oct 2016 03:46 PM
Example:

local options = Objects[Category]:getChildren()
local pick = options[math.random(#options)]
Report Abuse
GhostAction is not online. GhostAction
Joined: 06 Aug 2014
Total Posts: 444
12 Oct 2016 03:46 PM
so your saying i should just use

blabla:GetChildren()[2k14meme]
Report Abuse
GhostAction is not online. GhostAction
Joined: 06 Aug 2014
Total Posts: 444
12 Oct 2016 03:47 PM
oh i get that

thanks
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