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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 06 Feb 2010 |
| Total Posts: 274 |
|
|
| 08 Dec 2014 11:02 AM |
| What if I used FindFirstChild? |
|
|
| Report Abuse |
|
|
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 |
|
|