I’m making a function that changes what map a player is in. To achieve this, the server has all maps loaded at once and then the client sets the parent of all maps but the selected map to replicated storage, and then fills in terrain. Trouble is, I have no idea how to change that many variable properties at once.
I believe you want to make a map that load at some rounds, right? Use folders, save the entire map inside folders and store them inside the replicatedstorage, then parent them to the workspace…
No all maps will be loaded at the same time (On the server at least) because there will be multiple matches at once, and the client’s job is to move every map that is not loaded to replicated storage so it doesn’t render on the client.
perhaps you should load the maps locally, through each client that needs it, and not on the server. If you load everything on the server, the server makes sure that it gets replicated to every client, which is not what you want to do.
Just make sure that the game loads the maps to the respective players through a local script, and then see them fight in each area. I don’t think it’s impossible to do an event where the server loads all maps and the clients load them locally, If it’s possible I’d load the maps on the server and then, through a local script, I’d destroy the rest of the maps that are not used. Otherwise you could load no maps to the server and the respective one to the clients…
I don’t know, I’m not in my clearest moment. If I didn’t help, let me know…
I was thinking that but then nothing the client does will be replicated to the server unless I make a script that manually does that but that would be even more annoying than Just listing every map folder and parenting it to replicated storage.
[How should I handle loading maps?](maybe this can help you?)
If you want something made by the client to be replicated to the server, you should call in remote events or remote functions for the game to make specific actions, and that those actions are based off functions. Like, if its a battle game where players do movement sequences, you should make a local function on the server that gets called when a player presses a button, using the parameters for info, so you know which player should do it.
That isn’t really how I want to load maps. I just want to find out how to mass change properties for now and then I’ll start making the change map code.
Ok I had to figure this out by myself.
local children = game.Workspace.maps:GetChildren()
---A few lines later
for i = 1, #children do
local child = children[i]
if child:IsA("Folder") then
child.Parent = game.ReplicatedStorage.local_map_storage
end
end