so i got a folder in my ReplicatedStorage and i want everything inside be cloned to the Workspace folder GegnerStorage but it just wont work
local enemie = game.ReplicatedStorage:FindFirstChild("Enemies"):GetChildren() GegnerStorage = game.workspace:WaitForChild("GegnerStorage") enemie:Clone().Parent = GegnerStorage
the error says : ServerScriptService.MAIN:68: attempt to call method 'Clone' (a nil value)
When you use the :GetChildren()
method, it creates a table of all the instances in the object. You will have to iterate through each of the children and clone them to GegnerStorage
like so:
local enemie = game.ReplicatedStorage:FindFirstChild("Enemies"):GetChildren() GegnerStorage = game.workspace:WaitForChild("GegnerStorage") for _,obj in pairs(enemie) do obj:Clone().Parent = GegnerStorage end
If this has solved your problem, accept it as the answer and vote up if you feel like it!