Preloading meshes?

  1. Hey I am wondering how to make a preload so the game doesn’t lag how would I make it you don’t need to make it for me I just need some direction

  2. I haven’t tried anything yet just looking for direction I tried looking on the dev hub but couldn’t find anything
    I just need a way to preload meshes so they aren’t grey

I would include a video or image but I can’t take screenshots or record.

3 Likes

Preloading assets loads meshes and decals, it doesn’t make games lag

3 Likes

pretty sure you can just do like
game:GetService('ContentProvider'):Preload('https://www.roblox.com/asset/?id=assetid)

(reposted cause replied to wrong person)

3 Likes

ContentProvider:Preload has been deprecated in favor of ContentProvider:PreloadAsync

Their functionality differs in that you pass an array of instances you want to be fully loaded to it, rather than a link to an asset. You’ll also probably want to do this from a LocalScript in ReplicatedFirst, but not necessary if the meshes aren’t seen as soon as the player joins.

I think the old Preload will work fine if you really want to use that, but it’s always recommended to use the new stuff because they are often more reliable and well supported.

2 Likes

I will try both methods to see which is best.

1 Like

Also the rbxassetid will only work for textures…
You’ll need to create a instance list for meshes.

local Assets = {}

for _, Object in ipairs(workspace:GetDescendants()) do
	if Object:IsA("MeshPart") then
		table.insert(Assets, #Assets+1, Object)
		wait()
	end
end

This is what I use.

3 Likes
local Assets = {game.Workspace.RANDOMMESH} 

ContentProvider:PreloadAsync(Assets)

Came up with this within a couple minutes

1 Like

Yeah, that’s work. The system I made was for a already built game with a TON of MeshParts, that some were named and some weren’t. So I made the for loop to handle that all.

1 Like

Yeah, Question is it ok if I use that for my game?

1 Like

Sure thing! :smiley:
(30 chars)

1 Like

Thanks for helping with it really appreciated.

1 Like