Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to ungroup a Map from ServerStorage?

Asked by 10 years ago

Ok so I have this game, and it picks a random map from SerevrStorage, then puts it in a Model called "MapHolder" in Workspace. I need i once its put in the MapHolder, to ungroup the map. Is there part of code that can do it, like :unGroup() ??

    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)

This picks a random map. What i need is when the map goes to MapHolder, it ungroups itself. I would post the whole script, but the script is like 100 lines long. Anyone help??

2 answers

Log in to vote
0
Answered by 10 years ago

Make the (children of the map's) parent to the MapHolder, then delete the map model.

for i,v in pairs(mapChosenClone:GetChildren()) do
v.Parent = mapChosenClone.Parent
wait()
mapChosenClone:Destroy()
end
0
so this will put the map in MapHolder and Ungroup at the same time? NinjoOnline 1146 — 10y
0
That dosent answer my question NinjoOnline 1146 — 10y
0
Then what exactly are you asking here.? I've edited the script with your variables, just put that after wait(2).. that ungroups the chosen map's clone, moving all the children into the MapHolder, then deleting the empty model. infalliblelemon 145 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Why not just put it all in workspace instead of adding it to the model then ungrouping it?

0
Cause then all the maps and stuff have to load at once, even if it's not being used at the time. infalliblelemon 145 — 10y

Answer this question