I can’t really explain it in the title, but you should hopefully be able to see what I’m trying to do
if tilepath ~= nil then
local clonetile = tiles[tostring(tilepath)]:Clone()
The tilepath is grabbed from a table I have Table:
["rocksvariant1"] = {
['chance'] = 20,
['path'] = 'RocksVariant1'
The script knows what tiles are Reference:
local tiles = script:WaitForChild("ProceduralForestTiles"):GetChildren()
and If I print the tilepath variable i get Output:
Rocksvariant1
So how would I use the variable as a path, I’m trying it the way I have it now but I’m getting this error
[05:17:28.106 - Workspace.CurrentMap.ProceduralGeneratorScript:134: attempt to index nil with 'Clone'
Basically im trying to sort of make it say “tiles.RocksVariant1:Clone” Without it actually saying that.
Thanks.

3 comments
local clonetile = tiles:FindFirstChild(tilepath) Is giving me the error 13:07:37.006 - Workspace.CurrentMap.ProceduralGeneratorScript:132: attempt to call a nil value, I'm assuming this means tilepath is indeed nil but when it prints the output its all good
No the error means that the tiles variable is indeed nil. Check to see if your tiles variable is ok.
Find first child does not error unless you try to use the child before checking if it is actually there. Your problem is that the object that calls find first child is not there