Tracking Objects in map

I want to add pointer that is always tracking certain object in a map. Like when dynamic objective is changing, I want pointer to new objective position to be displayed to a player.
Can anyone please suggest best way of doing this. It can be with UI elements or 3D objects.

You could wite an "API" which is basically just a script with some logic that lives statically in your program without being added to the game world.


API = {objects = {}}

function API.Set(key, value)
	API.objects[key] = value

function API.Get(key, value)
	return API.objects[key]

function API.GetAll()
    return API.objects

Then you can assign any other game object, like a script the ObjectTracker.lua as a property and use it like this:

local objectTracker= require(script:GetCustomProperty("ObjectTracker"))
objectTracker.Set("importantObject", myObject)
local importantObject = objectTracker.Get("importantObject")

for _, object in ipairs(objectTracker.GetAll()) do

You can use the UI.GetScreenPosition(Vector3) to get the 2D position on screen of a point.

UI Documentation