I have a part of a script where it clones an object out of a folder, into a worldmodel in a viewportFrame. and it doesnt work. The thing thats baffling me is that it works when you dont clone it. (meaning theres nothing in the folder left). Any help?
for i,tower in pairs(workspace.ViewportFrames:GetChildren()) do
local clone = tower:Clone()
if clone.Name == script.Parent.Parent.Name then
clone.Parent = script.Parent.WorldModel
end
end
“The thing thats baffling me is that it works when you dont clone it. (meaning theres nothing in the folder left).”
I can be misunderstanding you a bit, but so the issue is that when do you do clone it, the stuff in the folder is still there, but when you don’t clone it the folder is empty. That would make sense why happens because when you use :Clone() it creates a copy of that instance. My question is why would you wanne clone it?
So, I am trying to clone things out of a certain folder into a worldModel inside a viewportFrame. When I use the :Clone() function, it doesnt work, which is really weird since it works perfectly fine if I dont clone it, and just paste it into the viewport. I dont know how cloning and not cloning would make a difference when scripting, so this is really weird. I would also like to use the non-clones, for future use. Sorry if this didnt help, I tried to give as much info as possible.
It was originally in workspace, then i put it in replicated storage saw that the animations wouldnt load if i put it in the viewportFrame. I’m not so sure on how to fix it.