Im essentially trying to clone a model I have in ServerStorage from a variable path name that is defined in my function.
local function construct(region, Player) local newChunk = "game.ServerStorage.Chunks."..region local create = newChunk:Clone() create.Parent = workspace create = workspace:WaitForChild(region) create:MoveTo(Vector3.new(100,0,100)) transportPlayer(Player) end
When I print newChunk, the string always points to the correct path, however im throw a ServerScriptService.RegionManager:21: attempt to call method 'Clone' (a nil value) error when i go to clone newChunk.
If I manually paste the string with the name of the model into the line though, the code executes fine
local create = game.ServerStorage.Chunks.Region2:Clone()
Which leads me to believe the clone function is having trouble interpreting the path from the string. Do I need to parse the string into something else for the clone to correctly function, or am I missing something else all together.
You're calling it on a string, you can use object[string] to index direct children.