if game.Players.NumPlayers > 1 then h.Text = "Deciding what map to play" wait(5) ranMap = math.random(1, #map) mapChosen = map[ranMap] h.Text = "Map Chosen: " .. mapChosen.Name wait(3) mapChosenClone = mapChosen:Clone() mapChosenClone.Parent = game.Workspace.MapHolder wait(2)
Ok, so this will pick a random map from ServerStorage. It then takes that map to MapHolder. I need an added extra. I need it to ungroup itself once in the MapHolder. Anyone help?
"Ungrouping" is equivalent to setting the Parent
property of each Child of the Model
to the Model's Parent
value, and then deleting the Model
that contained the children.
You can write a function to do this for any object:
function Ungroup(instance) for _,v in pairs(instance) do v.Parent = instance.Parent --change Parent of each object end instance:destroy() --Delete the previous parent of the objects end