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: Why can't I add this like a string?

Previous Thread :: Next Thread 
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
05 Dec 2014 11:54 PM
How do I do this? XD

Code-

RoomNum = 0
RoomNum = RoomNum + 1
Room..RoomNum.Position.Y+3 -- TRYING TO USE .. TO ADD I WANT IT TO SAY "Room(RoomNum's Value as apart of name).Position.Y+3"
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
05 Dec 2014 11:59 PM
Well, first of all you aren't doing anything with the string

So it errors for the same reason this does

"hello " .. "world"

Its a string but you aren't doing anything with it

Another reason is this

RoomNum = 0
RoomNum = RoomNum + 1
Room..RoomNum.Position.Y+3


so RoomNum is 0
Then RoomNum is 0 plus 1 (1)
Then you say Room .. RoomNum.Position.Y+3

and thats the same as
nil .. 1.Position.Y+1

Because 'Room' is nil and RoomNum is 1, and 1 doesn't have a position, it is a 1
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
06 Dec 2014 12:06 AM
You're right. "Room" is nil. But Room1 is not. I'm try to call Room1 using "Room" as a root word and 1 as the suffix.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
06 Dec 2014 12:08 AM


getfenv()["Room" .. RoomNum].Name = "omg a room"


Assuming Room1 is an object, so it has a .Name
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
07 Dec 2014 09:05 PM
What's wrong with this ?

v.Character.Torso.CFrame = CFrame.new(Vector3.new(["Room"..RoomNum].Position.X,["Room"..RoomNum].Position.Y+3,["Room"..RoomNum].Position.Z))
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
07 Dec 2014 09:21 PM
Nvm. I'm just gonna use an alternate way.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Dec 2014 01:55 AM
["Room"..RoomNum].Position.X

Because strings do not have a position property

You are basically saying

"room1".Position.X

Variables are not strings
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
08 Dec 2014 11:02 AM
What if I used FindFirstChild?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
08 Dec 2014 01:35 PM
I don't see how that helps unless there is like a model with a bunch of rooms called 'Room1' 'Room2' and so on


then you do

workspace.Model["Room" .. RoomNum].Position

Or use findFirstChild but there is no reason for it
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