Minimap module - Minimap creator

Note: This module has been remade, if you’re looking for the older version, there will be a link in the links section.
Update: This module is no longer being maintained, if you require a minimap module which is being maintained, I’ve linked one at the bottom of this post.

Why did you remake your module?

Well, the old module had many flaws and, it wasn’t optimised really well in my opinion so, I remade this module, more variables are localised reducing the need to index multiple tables at a time, this is done through the use of bindable events, so, if there’s a significant change (e.g. Frame size changes), certain ratios will be recalculated and an event will be fired which will cause certain local variables to be “reassigned”.

Preview

How to use the module?
Making an image

First, you’ll need an image to work with, you can create an image by manually creating one using Adobe Photoshop or, alternative, I recommend using Ro-Render Minimap Creator [RoRender], also, make sure to find out the center of your map/what the image represents since, positioning the minimap can be a bit tricky if you dont. To do this with RoRender, go to Workspace > Camera > MiniMapItems > CamFrame, make sure to save the position somewhere, such as Notepad.exe or some paper as it will be really important later on.

Creating a minimap object

Now that we have our map image, we can begin, first, we need to create a minimap object, we can do this by calling a module function in our module.

module.CreateMinimap(FrameSize, FramePosition, AnchorPoint, MapCenterPoint, PixelsPerStud, OriginalSize, Visible, OtherProperties, Key)

FrameSize can be a Udim2 value or false/nil, if it’s false/nil, it will be set automatically to UDim2.fromOffset(200, 200) [200 x 200 pixels]

FrameSize can be a Udim2 value or false/nil, if it’s false/nil, it will be set automatically to UDim2.new(0, 5 , 1, -5)

FrameSize can be a Vector2 value or false/nil, if it’s false/nil, it will be set automatically to Vector2.new(0, 1)

MapCenterPoint will be the center of your map/(what your minimap represents), if an incorrect value is passed through, your minimap may not be correctly positioned.

PixelsPerStud is really important, it will be used to calculate certain ratios, it can be a table or a double/integer/float/number, if it’s a table, table[1] will be your pixels per stud in the x axis and table[2] will be your pixels per stud in the y axis or else, if it’s just a number, it will be assumed that it represents both the x axis and y axis.

OriginalSize is a table {number x, number y}, where number x/y represent the original size of the image in pixels, e.g. 1080 x 1920, if nothing is passed through, the absolute size of your map will be used instead.

Visible is a boolean and, it’s recommended that it should always be true, since, you’ll have to manually enable the map (ScreenGui) if you decide to pass through false.

OtherProperties is a table of properties, e.g. , if you wanted the frame to be opaque(have a transparency of 0) you could pass through {[“Transparency”] = 0}, this is only recommended if you know what you’re doing or else, it’s best to leave it as false/nil or an empty table.

Key can be anything, it will be used to return the map if you’re using multiple scripts for some reason, it’s recommended that your key is a string, if you don’t intend on using the minimap object from multiple scripts, you could leave the value as nil.

Importing a map image

Now that we’ve created a minimap object, we can now import our map, to do this, we can call the function/method

Minimap:ImportMap(Map, Size)

Map can be a frame/(image label) or, it can be a link to an image, it’s recommended that you don’t use a link since, you can’t be certain if it will load.

Size will only be used if you decide you use a link, if so, Size is a UDim2 value.

Importing a main blip

Now that we’ve imported our map, we can import a main blip, to do so, we can call the function/method

Minimap:ImportMainBlip(Blip, Part, UsingOrientation)

Blip will be the main blip, it can be a frame or an image label
Part will be your main part, this will determine the offset of your map
UsingOrientation will determine whether you want the blip to rotate, it can be either true or false

"Run"

Now that we’ve imported our map and main blip, we can “run” our minimap (doing calculations and updating the offset of our map), to do so, we can call the function/method

Minimap:Run()

Updating the main blip part

What if our main blip part is no longer our main part?
Well, in that case, we can call the method/function

Minimap:UpdateMainBlipPart(Part)

Part is your new main part

Adding blips

What if I want to add other blips?
Well, to add other blips, you can call the method/function

Minimap:ImportBlip(Blip, Part, Orientation, Enabled)

Blip is your blip image, it can be a frame or an image label
Part is the part the blip is going to represent
Orientation is a boolean and will determine whether the blip will be able to rotate
Enabled is a boolean and, will determine whether you want the blip to be visible or not visible.

Enabling/Disabling blips

To enable/disable a blip, you can call the method/function

Minimap:EnableBlip(Part)
Minimap:DisableBlip(Part)

Part is the part you used to add a blip.

Updating your main blip

To update the image/frame of your main blip, you can call the method/function

Minimap:UpdateMainBlip(Blip)

Removing a blip

You may want to remove a blip instead of disabling it to reduce the amount of resources/memory being used or to prevent any memory leaks.
If you don’t want to use a blip anymore, you can call the method/function

Minimap:RemoveBlip(Part)

Updating a blip part

Instead of adding a new blip each time, you may want to update the part it represents, to do so, you can call the method/function

Minimap:UpdateBlipPart(OldPart, NewPart)

OldPart is the part the blip used to previously represent and NewPart is the part it currently represents.
OldPart will be used for a table lookup to find the blip associated with it.

Updating a parts blip

You may want to update a blip that represents a part instead of adding a new blip, to do so, you can call the method/function

Minimap:UpdateBlipIcon(Part, NewBlip)

NewBlip is your new frame/(image label) that will represent your part.

Changing maps

You may want to rotate/change maps for some reason (e.g. a round based game where maps are random), to do so, you can call the method/function

Minimap:ChangeMap(Map, MapCenterPoint, PixelsPerStud, OriginalSize)

Map is your new map image

MapCenterPoint is the center of your map/(what your map represents), it is a Vector2 value where x represents the x axis of the center of your map and y represents the z axis of the center of your map.
e.g.

local MapCenterPoint = Vector2.new(Baseplate.X, Baseplate.Z)

PixelsPerStud is really important, it will be used to calculate certain ratios, it can be a table or a double/integer/float/number, if it’s a table, table[1] will be your pixels per stud in the x axis and table[2] will be your pixels per stud in the y axis or else, if it’s just a number, it will be assumed that it represents both the x axis and y axis.

OriginalSize is a table {number x, number y}, where number x/y represent the original size of the image in pixels, e.g. 1080 x 1920, if nothing is passed through, the absolute size of your map will be used instead.

If you have any suggestions/ideas/requests feel free to message me or post below.


Links
Remade Module

https://www.roblox.com/library/5019777326/Minimap-module

Old Module

Minimap Creator [Out dated]
https://www.roblox.com/library/4845484624/Minimap-Module

RoRender

Minimap Creator [RoRender]

Example game (uncopylocked)

Minimap example - Roblox

What to do if you encounter problems

First, I’d recommend double checking any code you may have wrote to make sure you’ve passed through the correct arguments, then, you should check the dimensions of your image file and compare it to the values passed, if you still encounter problems, feel free to message me on the forums with your problem, and the arguments you’ve passed through.

This module is no longer being maintained but, it should still work though.
I recommend using this module if you want to use a module which is currently being maintained instead:

85 Likes

Great stuff, but what traits should the minimap image itself have?

2 Likes

There aren’t really that many traits the minimap image should have except a few traits…

The size of the minimap image must be larger than the size of the frame it’s in.
(The size of the frame is determined by what you pass through the function that is returned when you call the module).

The center of the image must represent the center of the map since calculations are done based off the center.

It doesn’t matter whether the size of the image is based off a scale or an offset since calculations are done using the AbsoluteSize.

The image doesn’t need to be a square, it can have any aspect ratio as long as the length and width of the image are larger than the corresponding length and width of the frame they’re going to be parented to.

3 Likes

Is there a way to define the centre of the image or is it, quite literally, THE centre of the image itself? I’m having some problems with it.

Quite literally the center of the image itself, I’ll make some edits to the module which should allow you to define the center.

2 Likes

Thank you! The problem is that I’ve got quite an irregular map. I’m also doing this in a game where the map changes and the orientation may be different on different maps, and I assume this will be an issue.

.

3 Likes

You can now change the map using Minimap:ImportMap(map) and, you can change the center point using Minimap:SetCenterPoint({x, z}) where x and z are coordinates in worldspace which represent the center of the map used.

2 Likes

Thank you for all of your work on this and for helping me out! I’ll see if I can get some neat results!

2 Likes

Do you have any tips for lining up the map image with the map itself? The problem is, again, my map is very large and has a lot of spare space outside of the playable area. I calculate the middle of the physical map automatically because doing it manually for every single map (current and in the future) would be fairly painful but still somewhat managable if needsbe.

1 Like

If I’m not mistaken, I’m going to assume the map size changes, if so, you’ll need the size of the physical map so the correct ratios may be calculated, when you change a map, you can call the function Minimap:SetMapSize({number x, number z}) where x and z are the dimensions of the new physical map (in studs).
In the updated version of module

I’m not exactly sure what’s happening, I’m likely doing something wrong. It’s showing this as the minimap. The main blip barely moves unless I move out far from the spawn.
image

I copied the entire map and disabled ClipsDescendants to show more of what’s going on.
image

I’m out of ideas as to why it doesn’t work. I’m going to head out for now as it’s 2am but if you have any ideas (although I didn’t give you much to work with) let me know.

Thanks either way for all of the work you’ve done!

It turns out the module assumed that the center was 0, 0, 0*(most likely due to fact that I was working with a baseplate positioned at 0, 0, 0)* and, it wasn’t designed to do calculations based off negative center points, after a bit of tweaking I was able to get it to work with center points other than 0, 0, 0 it should work now, hopefully.

If any errors persist, feel free to message me.

2 Likes

Unfortunately the exact same problem seems to be persisting. I am using the updated module.

Could you message me the values which you passed through the module?

local MapCentrePos = MapModel:GetBoundingBox().p
local MapSize = MapModel:GetExtentsSize()

local Minimap = module({0, 200, 0, 200}, false, {MapCentrePos.X, MapCentrePos.Z}, {MapSize.X, MapSize.Z})

If you need anything else, I’ll be happy to give it!

What do the values MapCenter and MapSize equal?
Since the map is being loaded in , it might be a problem with MiniMap:ImportMainBlip(), could I see the values passed through MiniMap:ImportMainBlip()?

Minimap:ImportMainBlip(BlipTable.Player:Clone(), HumanoidRootPart, true)

As for the values:
Center: -1.25588989, 125.461227, -6.15682983
Size: 1905.67554, 250.722916, 2270.052

I’m currently trying to replicate the same problem, what’s your image size?

A relatively small 652x545, however, this is mainly a placeholder for a more edited image once I’ll get the system working

I sent the entire image earlier in this thread, if you’d like to test on it.

I was able to create a map with similar dimensions and it seems to be fine
Minimap - Roblox
could you try using the script in this game, if it works, it might not be the module