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't read a string?

Previous Thread :: Next Thread 
compy111 is not online. compy111
Joined: 02 Apr 2009
Total Posts: 583
13 Feb 2015 10:05 AM
In my game you'll be able to build your own space ship, set engines on it, choose hotkeys and do objectives.
So in the control script of the ship we need to make a table out of all engines used and their hotkeys.
The key is stored in a StringValue inside of the engine model.

local parts = ship:GetChildren() --These are all parts of the ship, engines are models
local enginelist = {nil}
local keylist = {nil}
for a = 1,#parts do
if parts[a].Name == "Engine" then --If the child is named Engine
print("Engine found")
enginelist[a] = parts[a] --add the engine to the enginelist
keylist[a] = parts[a].Key.Value --add the key to the keylist
end
end
print("Keylist: "..table.concat(keylist,", ")) --Print the table



Output of ship with 4 engines:
Engine found
Engine found
Engine found
Engine found
Keylist:

It clearly says it find the engines but he doesn't want to put the keys into a table.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
13 Feb 2015 10:08 AM
"enginelist[a] = parts[a]"
No.

table.insert(enginelist, parts[a])

You do not need to put nil as the first value in the table, just do {}.
Report Abuse
compy111 is not online. compy111
Joined: 02 Apr 2009
Total Posts: 583
13 Feb 2015 10:10 AM
Thanks, got a correct output now
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