So im making a game like the normal elevator. And i am adding a round where "computer" enters the elevator but when the round is over it disapears. I put all the rounds in lighting help pls
local model = --(Your model) local children = model:GetChildren() for i,v in pairs(children) do v.Parent = --(Where you want the children to go) end model:Destroy()
Use a for i,v in pairs do statement. Basically this just sifts through a table and runs code for every value in the table.
Replace the comments with what is supposed to go there. That script takes all the children of a model and relocates them to wherever you specify. Then after it's done, it deletes the model. If this helped, accept the answer. :)
I'm not very good with this, but the method I'd use'd be to move the children somewhere else. Then delete the model.
Imagine this: You have a model in Workspace named "Model" with 2 parts named "Part1" and "Part2" respectively. You'd want to do:
game.Workspace.Model.Part1.Parent = game.Workspace game.Workspace.Model.Part2.Parent = game.Workspace game.Workspace.Model:Destroy()
Closed as Not Constructive by Leamir, Lugical, and saSlol2436
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?