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

Which method is the best way to load a map into the game? [closed]

Asked by 5 years ago

Currently, I am working on the core game mechanics in my place, and I'm stuck with a decision. Do I load in maps using InsertService() or do I load them in by having the maps in my game already, and then cloning them into the workspace? Will the second method break any map scripts? Will the fact that the map is just sitting there in my game's ServerStorage slow down performance?

Method #1

local map = game:GetService("InsertService"):LoadAsset(13456733)
map.Parent = workspace          

if workspace:FindFirstChild("Model") then
    for _,ungrouped in ipairs(workspace.Model:GetChildren()) do
        if not ungrouped:IsA("Terrain") and not ungrouped:IsA("Camera") and not ungrouped:IsA("Folder") then
            local u = ungrouped:Clone()
            if u then
                u.Parent = workspace
            end
        end
    end
end
workspace.Model:Destroy()

Method #2

local map = game.ServerStorage.Map1:Clone()
map.Parent = workspace
0
don't post opinion-based questions DeceptiveCaster 3761 — 5y
0
This isn't opinion based, I'm looking for an answer that is backed up with facts. laughablehaha 494 — 5y
0
No its opinion based. DinozCreates 1070 — 5y
0
Ok fine whatever you say laughablehaha 494 — 5y

Closed as Primarily Opinion-Based by DeceptiveCaster, laughablehaha, DinozCreates, zblox164, RetroGalacticGamer, and User#24403

This question has been closed because it is a discussion about a topic focused on diverse opinions, which isn't a good fit for our Q&A format.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 5 years ago

I prefer ServerStorage because:

  • It's already in the game, which means you don't have to load it through InsertService
  • If it auto-updates due to the model referred to by InsertService updating, the current server (with the non-updated scripts and such) won't break
  • You can access it like any other object, no fancy InsertService magic

InsertService may be good if:

  • You need something to auto-update, and the new version will work on old servers
  • You don't want to include something in ServerStorage
  • You're actually inserting something (i.e. a Free Model or something, which is probably isolated from the rest of the game)

Each has its own pros and cons, but here are some to start.

Don't worry about making the right choice, because there isn't much of a difference... but whether to auto-update or not is one thing you should consider.

Hope you figure it out!

0
Wow, learned something new here, it auto updates. I'm going to fact check that, but thank you very much for you answer. laughablehaha 494 — 5y
0
InsertService always loads the latest version of a particular model IIRC TerrodactyI 173 — 5y
0
When you call LoadAsset, I mean. It doesn't update models already inserted, but at the point of insertion, it's always the latest version, I think TerrodactyI 173 — 5y
Ad