Thanks for viewing my question.
So is there a way to convert string to instance such as converting “game.Workspace.testfolder” into game.Workspace.testfolder so you can do something such as:
1 | location = converttoinstance(“game.Workspace.testfolder")— function you convert |
2 | test = instance.new(“Part”) |
3 | test.Parent = location |
Hmmm... I think this is the most efficient way of doing it...
1 | local string = "testfolder" --assigns a string to a variable |
2 | local instance = game.Workspace:FindFirstChild(string) --finds the instance that has the same name as the string |
or...
1 | local instance = game.Workspace:FindFirstChild( "testfolder" ) |
But to know answer your question tho, I don't think there is another way of converting string to an instance. Hope this helps! :>
What you can do is like:
1 | string 1 = "Part" --Write the name of the Instance you want to create |
2 |
3 | local NewInstance = Instance.new(string 1 ) --This will make a Part |
4 | NewInstance.Parent = workspace --You need to set the parent of the Instance too |
I hope this helps