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

Anything wrong with this?

Asked by 10 years ago
maps = game.ServerStorage.Maps:GetChildren()



function loadMap(map)

table.foreach(Workspace.currentMap:GetChildren(), function(i,v) v:Remove() end)--remove children

nmap = map:Clone()

nmap.Parent = game.Workspace.currentMap

nmap:MoveTo(Workspace.mapLocation)

end



function randMap()

 loadMap(maps[math.random(1,#maps)])

end

It's a map changing script.

1 answer

Log in to vote
0
Answered by 10 years ago

First of all, table.foreach is deprecated. Use this instead:

for i,v in pairs(game.Workspace.currentMap:GetChildren()) do
    v:Remove()
end

Otherwise that looks like it would work just fine.

Ad

Answer this question