How to efficiently have an updating minimap system?

I’m trying to incorporate a minimap system to my roleplay game, however I get huge lag spikes with it. At the moment, I have 2 separate islands. And I just copy paste them into the viewport frame.

I’ve thought of possibly having only 1 island in the viewport frame at once?? But I don’t know how much that’d actually reduce lag.

I can’t use images either, as I want to incorporate changes in the maps, like when a new player joins, their house model loads in on the map/etc

--// Update map position
local function UpdateMap()
	local Character = Player.Character
	if not Character then return end
	
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	local Humanoid = Character:WaitForChild("Humanoid")
	
	local CameraCFrame = CFrame.new(
		HumanoidRootPart.Position + Vector3.new(0, Zoom, 0),
		HumanoidRootPart.Position
	)
	
	Camera.CFrame = CameraCFrame
	
	PlayerArrow.Rotation = -HumanoidRootPart.Orientation.Y - 90
end

Islands themselves are quite large

1 Like

Where are you calling this function?

And do you have an entire copy of the map inside the viewport frame? Yikes! How do you keep the clone in sync with the workspace version?

I don’t recommend cloning the entire map. Try RoRender or some other plugin that generates an image of your map.

I’m sorry but are you just importing the map into a viewport frame without graphical handling?
What I mean is that do you have a alternative map that is created in box view similar to that of GTA 5

EDIT:
If you are not graphically handling them and also don’t want the mini map to be just boxes I suggest you have a look at this post about chunk loaders, essentially it will lower the details of the buildings in the minimap depending on the position you give it (I leave implementation to you)

If you want it in box format similar to that of GTA 5 then I don’t know a good way of handling that…

I tried that, however I don’t want to use an image

Use an image for the map without the houses and put it behind the viewport frame, that way you don’t have to clone the entire map.

ViewportFrames mean you will need to duplicate the parts effectively meaning you have double the parts in your place just for the minimap.

The efficient way to do this was already suggested, using an image. You’re not going to find anything more efficient than that. If you want to show player houses, incorporate both. Image for the main map, overlaid with a ViewportFrame showing the player’s house.