Documentation

Optimization for big maps:
An easy way to reduce lag is to enable Minimap.HideObstructed which uses an optimized system to find unnecessary objects that can't be seen and remove them.
It is recommended that you disable ResetOnSpawn for any Minimap GUI to prevent unnecessary reloading.

Module.new(Viewport:ViewportFrame, CameraPosition:Vector3, MapHolder:Instance?):Minimap

Creates a new "Minimap" using the provided ViewportFrame and Map.
Minimap:Refresh() must be used to load the map.

Properties:
MapHolder:Instance The folder or container used inside the Minimap. (REQUIRED) (Set to workspace to show everything)

CameraPosition:Vector3 The camera position used for displaying the map.

CameraRotation:CFrame The camera rotation used for displaying the map.

TrackerCamera:Camera The camera used for :Track().

TrackerPart:BasePart The part used to centering the camera when using :Track().

TrackModes:{Fixed,Rotate,Position,FullTrack} Modes used for camera tracking. (READ-ONLY) See Minimap:Track() for more info

TrackerMaxAngle:number The maximum up/down angle that the camera can face when using :Track().

TrackerMinAngle:number The minimum up/down angle that the camera can face when using :Track().

HideObstructed:boolean Removes all parts hidden from (top-down) view using a super optimized system. Reduces lag for maps with large part counts.

Flatten:boolean Flattens all parts to look 2D.

WaypointAutoSize:boolean Automatically changes the size of waypoints whether they are on-screen or not. This mainly works alongside WaypointEdges. Defaults to true.

WaypointEdges:boolean Forces all waypoints to clamp against the Minimap edges when off-screen.

Rotation2D:number The 2D rotation offset of the Minimap. This is overridden when tracking is enabled.

FPSCap:number Caps the FPS of the Minimap.

ExtraWarnings:boolean Prints extra helpful warnings in console when enabled. Defaults to true.

DebugEnabled:boolean Prints extra debug info in console when enabled. Defaults to false.

Minimap:Refresh(IgnoreMap:boolean?):{Instance?}

Refreshing will position and rotate the viewport's camera to match the set properties (Unless tracking)
Unless IgnoreMap is true, this loads the selected MapHolder and clears all old parts from the frame.

Returns all parts that have been added to the Minimap.
This can be used to update for any changes made to the map.

Notes:
This will create a new camera for the viewport if none is already set.
This may cause temporary lag at high part counts and is recommended to not be used frequently.

Minimap:Track(TrackMode:number, Smooth:boolean?, XEffectiveness:number?)

When enabled, the viewport camera matches the position and rotation of the set TrackerCamera.
The camera will be centered around the optional TrackerPart if set.

Smooth: Smooths rotation and position movements while tracking
XEffectiveness: How much of an effect up/down rotations will make on the viewport camera. (1 Default)

Set the TrackMode using: :Track(Minimap.TrackModes.MODE)

Minimap:StopTracking()

Stops camera tracking.

Note that this does not reset the camera position or rotation.

Minimap:Clear()

Clears all map parts from the Minimap.

Note that this may cause temporary lag at high part counts.

Minimap:Destroy()

Disables and cleans up the Minimap.

Note that this does not clear waypoints.
To clear waypoints see Minimap:ClearWaypoints()

Indicators

Minimap:AddIndicator(Name:string, Template:BasePart|Model, Part:BasePart):{Settings}

Creates a new indicator to track the position and rotation of the given part.
This will track the rotation of the optional Camera if set.

If the Template is a Model and a primary part is set, it will become the pivot point.

Properties:
AlwaysOnTop:boolean Whether the indicator should be displayed above everything else or not.

Visible:boolean Whether the indicator should be visible or not.

Camera:Camera The camera used for indicator rotation. Good for following where the player is looking.

RotOffset:Vector3 Rotational offset.

_YOffset:Vector3 Y axis position offset. Set automatically to prevent Z-Fighting.

Minimap:RemoveIndicator(Name:string)

Removes any indicator with a name that matches the given text.

Minimap:ClearIndicators()

Removes all existing indicators.

Waypoints

Minimap:AddWaypoint(Name:string, Position:Vector3, ImageOrText:string?):Frame

Creates a new waypoint on screen using the template frame that tracks the provided position. (Located inside the ModuleScript)

The ImageOrText will change the waypoint's text or (if it contains "rbxassetid://") will change the image based on the given ID.

The text and/or image can be modified afterwards using the returned Frame.

Minimap:RemoveWaypoint(Name:string)

Removes any waypoint with a name that matches the given text.

Minimap:ClearWaypoints()

Removes all existing waypoints.

Caching

Minimap:Cache()

Caches the currently loaded map, accessible using the MapHolder it was loaded from.

Note that this is not global and can only be accessed by the Minimap that it was cached from.


Example:
local Minimap = Module.new(Viewport, MapFolder, Vector3.new())
Minimap:Refresh()
Minimap:Cache()
task.wait(1)
Minimap:LoadFromCache(MapFolder)

Minimap:LoadIntoCache(MapHolder:Instance)

Loads the MapHolder and stores it directly into the cache to be used later, rather than applying it automatically.

Minimap:LoadFromCache(MapHolder:Instance)

Loads the cache that is currently linked to the MapHolder provided.

Note that this will not load anything if no cache is linked to the MapHolder provided.

Minimap:RemoveFromCache(MapHolder:Instance)

Clears the cache that is currently linked to the MapHolder provided.

Minimap:ClearCache()

Clears all caches linked to the Minimap.

Minimap:_GetCache():{{}}

Returns an array of currently saved caches.

It is recommended not to use this unless you know what you're doing.