You have to translate the X and Z coordinates of your position to scale, so this generally takes a little bit of time because you need some conversion factors.
First, you need an origin to start from (this doesn’t have to necessarily be a place on the frame but it’s way better if you use a place on the map that is on the render)
Use a while loop or RunService loop to constantly print out your root part’s position, and locate a spot on the render you want to use as your origin.
Then hop into play solo and go as close as possible to the origin position that you selected on the render, and then record the position (using notes or something). To get your X conversion factor, pick two positions on the render (UDim2s, you should be using scale only) from left to right (or up and down depending how your map is orientated), and record them. (To check this, walk left to right / up and down and the one with only the X value changing a lot is the right direction) Then hop into play solo, go to both of those positions, and record the Vector3’s for each one. To finally calculate your X conversion factor (scale / studs), do (UDimPos2.X.Scale - UdimPos2.X.Scale) / (Pos2.X - Pos1.X). You can switch the order that you subtract in but make sure the order of both is going in the same direction (ex. If UdimPos1 → UdimPos2 is going right, then the order you subtract the Vectors in should also be going to the right.)
If your minimap image is a perfect square luckily you will not have to calculate the conversion for the other axis (should be Z or X depending in what you did first). If it isn’t repeat the same steps but for the Z axis.
After this, you’re almost done. All you need to do now is put the conversion factors in a script, and move the position of the minimap relative to the origin with conversion factors.
Example:
local rs = game:GetService("RunService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local mapImage = -- reference to the image
local originUDim2 = UDim2.fromScale(0, 0)
local originV3 = Vector3.new()
local xFactor = -- conversion factor ex. .01 scale / 5 studs meaning that every 5 studs is = .01 X scale on the image
local zFactor -- same thing, but if your image is a perfect square this will be the same as the xFactor
rs.Heartbeat:Connect(function()
local delta = originV3 - root.Position
local deltaX = delta.X * xFactor
local deltaZ = delta.Z * zFactor
mapImage.Position = originUDim2 + UDim2.fromScale(deltaX, deltaZ)
end)
In the Heartbeat loop you may find yourself needing to switch the addition in the final line to subtraction but you get the jist.