Unable to get player position on image

Hello there,

So I am having trouble with trying to get the player position and converting it to the playerblip position, I have got mapImage to be shown on the whole screen depending on the players device screen size, I don’t know what I am doing wrong.

local function playerLocationMap()
	local currentTime = tick()
	if currentTime - lastUpdate < updateInterval then
	lastUpdate = currentTime
	local playerBlip = mapImage.PlayerBlip

	local onePixeltoStuds = .75
	local mapSize = Vector3.new(44760.5, 0, 12335.016)
	local mapCenter = Vector3.new(-6954.871, 235.177, -705.6)
	local playerScreenSize = mapImage.AbsoluteSize
	if rootpart then
		local ROOTPART_POS = rootpart.CFrame.p

		local relativePos = ROOTPART_POS - mapCenter
		local mapPosX = (relativePos.X / onePixeltoStuds) + (mapSize.X / 1)
		local mapPosY = (relativePos.Z / onePixeltoStuds) + (mapSize.Z / 1)

		playerBlip.Position = UDim2.new(0, mapPosX, 0, mapPosY)

If anyone knows why I can’t please don’t hesitate to tell me because I no clue.


Just to help this topic, the red box is where the playerbilp should be.

1 Like

You’ve added half of the map size to the player’s relative position. Does your map correspond to the origin of 0, 0? You’ve put mapCenter as Vector3.new(-6954.871, 235.177, -705.6) which might mean that the centre of your map doesn’t correspond to the origin from what I can see.


So I changed the code to be like this and it does show on the map however, it is miles off where it should be.

local mapCenter = Vector3.new(0,0,0)
local mapUIPosition = UDim2.new(0.5, 0, 0.5, 0)
local mapUISize = Vector2.new(1.001, 1)

local function playerLocationMap()
	local playerBlip = mapImage:FindFirstChild("PlayerBlip")
	local mapMesh = workspace:FindFirstChild("Maps"):FindFirstChild("MAP").Mesh
	local playerPos = clientplayer.Character and clientplayer.Character:FindFirstChild("HumanoidRootPart")

	if playerBlip and mapMesh and playerPos then
		playerBlip.Visible = true
		local mapSize = mapMesh.Scale

		local relativeX = (playerPos.Position.X - mapCenter.X) / mapSize.X
		local relativeZ = (playerPos.Position.Z - mapCenter.Z) / mapSize.Z

		local uiX = mapUIPosition.X.Scale + relativeX * mapUISize.X
		local uiY = mapUIPosition.Y.Scale + relativeZ * mapUISize.Y

		local newPos = UDim2.new(uiX, 0, uiY, 0)
		playerBlip.Position = newPos
		if not playerBlip then
			warn("PlayerBlip is not found in mapImage")
		if not mapMesh then
			warn("MAP is not found in workspace.Maps")
		if not playerPos then
			warn("HumanoidRootPart is not found in clientplayer.Character")

The red box is where I’m standing btw

Can you tell me the resolution/size of the mapImage that you’re using? Or preferably send me the decal ID or link.

Sorry for the late respond but the image of what I was using when I took the image is.

Resolution: 1920 x 1080

FOV: 21

ID: rbxassetid://18465196037