Ok, so again this isn't working...the output says Map# isn't a valid member of serverstorage, even though it is.
maparea = math.random(1,3) min = 0 sec = 5 print("start1") print(maparea) repeat script.Parent.Text = (min..":"..sec) sec = sec - 1 wait(1) if sec == 0 then wait(0.1) min = min - 1 sec = 59 print("minus 1 minute") end until min == -1 wait(0.1) min = 0 sec = 0 script.Parent.Text = (min..":"..sec) wait(5) game.ServerStorage("Map" ..maparea).Name:Clone().Parent = game.Workspace while true do wait() game.Players.LocalPlayer.PlayerGui.Timer.Clock.TimeLeft.Text = (min..":"..sec) end
Line 23 is where it says that it isn't a member of serverstorage. Everything except that works fine.
Change line 23 to:
game.ServerStorage["Map"..maparea]:Clone().Parent = workspace
Remember that parentheses go next to a function. Use brackets when you are trying to index a table with a non literal string. There is a difference between x(5)
and x[5]
. The first one means that you are calling a function called x with an argument of five, while the latter means that you are indexing the table x with five.
In addition, the script above is local but the Server Storage is only accessible by the server hence the name. Either place the maps in replicated storage or make the map on the server.