So, hopefully the title explains it all.

I'm using the "InsertService" a lot in my game, because i'm inserting a lot of models from my profile. This makes the game lagg a bit. Here's an example:

local sword = game:GetService("InsertService"):LoadAsset(0000000000) local bow = game:GetService("InsertService"):LoadAsset(0000000001)

and so on...

i'm not only loading tools but entire models too:

local merchant = game:GetService("InsertService"):LoadAsset(0000000002)

and so on...

Then when i want to spawn one of these things i simply :clone() them and set game.Workspace as Parent. For example: mysword = sword:clone() mysword.Parent = game.Workspace

instead of using ":LoadAsset" each time i spawn something, i would like to preload everything at the beginning. This would avoid a lot of lagg.

Robloxwiki only shows how to preload sounds. Here's the example:

Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=12222058")

My question is HOW DO YOU PRELOAD MODELS ?

So far i tried these solutions and they didn't work:

  • local merchant = game:GetService("ContentProvider"):Preload(0000000002))
  • local merchant = game:GetService("InsertService"):Preload(0000000002)
  • local merchant = game:GetService("ContentProvider"):Preload("http://www.roblox.com/Merchant-item?id=0000000002")
  • local merchant = game:GetService("ContentProvider"):Preload(0000000002)) game:GetService("InsertService"):Insert(merchant)

I tried a lot more combinations of insert and preload i even tried using only the model ID instead of writing down the entire link. So far nothing worked....

8 comments

0

Instead of using a service, maybe try cloning the models from a storage instance, such as ReplicatedStorage (LocalScript) or ServerStorage (ServerScript). It doesn't use assets from the net, therefore does not cause as much latency.

0

i'm using server storange and it works thx :D altho i'm still experiencing some lag. it might not depend from that. do you know which one is less laggy between server storage and replicated storage ?

0

There's no significant difference between the two storage instances besides the fact that they're both accessed differently. As mentioned before, ServerStorage is accessed by a server script, while ReplicatedStorage is accessed by a local script. Now, the difference is the scripts itself. If this script is more applicable upon the client, you should use-a local script. But in your case,

0

use a server script for NPCs.

0

Thx man :)

0

actually im inserting big models with hills, trees and buildings.

0

if its a map thats all anchored then parent it to workspace then parent it back to severstorage once done

0

you can directly parent it to serverstorage and later spawn it on workspace when needed :) thx anyway