To keep it brief, I’m writing a script to spawn a part randomly in one of 4 tiles in one of 15 sets of 4 tiles, and I noticed that I cannot use variables when calling an object in the workspace, because instead of using the variable value in the object call, the script attempts to find something with the same name as the variable resulting in an error. Is there any way I can circumvent this short of restructuring my script so as to not use variables in object calls (which would probably take a whole lot more effort to write) I’d appreciate any help, and thank you all in advance.
while true do
wait(10)
local SpawnLocation1 = math.random(1,3)
local SpawnLocation2 = math.random(1,5)
print("the spawn tileset is "..SpawnLocation1.."/"..SpawnLocation2)
local EncounterOrb = Instance.new("Part")
local SpawnLocationName = "Tiles"..SpawnLocation1.."/"..SpawnLocation2
local SpawnTileName = "Tile"..math.random(1,4)
print(SpawnLocationName)
EncounterOrb.Position = Vector3.new(game.Workspace.Folder.SpawnLocationName.SpawnTileName.x,game.Workspace.Folder.SpawnLocationName.SpawnTileName.y,game.Workspace.Folder.SpawnLocationName.SpawnTileName.z)
end