I’m making a camera system that positions the camera above an specific “cell” of the map, each cell has an ID assigned to it, which consists of a letter and a number (A1, B4, D12, etc…) said IDs are those parts’ names. I want players to be able to control the camera with WASD. W and S will change the letter of the ID allowing them to move in the Y axis, while A and D will change the number (x axis), since these two values need to be separated in order to mess with them I ended up with the following code:
local cellY = "A"
local cellX = "1"
local cellID = cellY .. cellX
local cellPos = workspace.cellID
local goal = {}
goal.position = Vector3.new(cellPos.position.x,40,cellPos.position.z)
This is supposed to let me modify both, the letter and number (lines 1 and 2 respectively) and then concadenate them to form the ID (line 3).
The problem with this code is that I can’t just use cellID’s content as a child of workspace (line 4) which basicly causes an error since there is not a part named “cellID” inside workspace and because of that I can’t use the variable cellPos as a point of access to the cell’s x and z position (line 7).
Is there anything I can do to “fix” this code or a better solution for what I’m tryng to do?
Note: This is just the part of the code that has the issue, the rest is basicly TweenService related stuff, if you want to check out that too let me know.