I have a image of my map i created tho blender, the image size is (0, 514, 0, 514) The image is scale by (0.2, 0, 0.2,0) I have a frame that size is (0.3, 0, 0.3,0) of my screen, the mapImage scale in this frame Their is also a arrow in the middle of the screen! http://prntscr.com/i9uj5t
Here is my code that moves the map image base off player position! I think my code below might be off! i get a offset when resizing my screen to large
module.RenderMinimap = function(gui)
local minimap = gui:WaitForChild("Minimap")
local arrow = minimap:WaitForChild("ImageLabel")
local mapImage = minimap:WaitForChild("Frame"):WaitForChild("ImageLabel")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local hrp = character:WaitForChild("HumanoidRootPart")
runService:BindToRenderStep("OffScreenIndicator", Enum.RenderPriority.Camera.Value, function()
local rot = module.ReturnRot()
arrow.Rotation = (360 - math.floor(rot * 57.2)) - 180
local positionx = (minimap.AbsoluteSize.X - hrp.Position.X) - (mapImage.AbsoluteSize.X - minimap.AbsoluteSize.X/2)
local positiony = (minimap.AbsoluteSize.Y - hrp.Position.Z) - (mapImage.AbsoluteSize.Y - minimap.AbsoluteSize.Y/2)
mapImage.Position = UDim2.new(0, positionx, 0, positiony)
end)
end
How would i be able to fix this so when i size my screen it doesn't have a offset..

4 comments
You can just set the size to {0.2,0},{0.2,0} and set the SizeConstraint to RelativeXX or RelativeYY. I would however suggest that you set the anchor point to the same corner that your UI is located in on the screen. That way the minimap will always have the same X resolution as Y resolution.
Alright so right now i did actly what you told me to do, but stil same problem, ever time i resize it in the Y it has a offset. https://gyazo.com/a73c07a2c80ad8f5310d2059c2a06fd7
This is the math now for it! https://www.hastebin.com/jatilulasu.pl
Look at these gif https://gyazo.com/f7bf960e502202c16369c28d71ce03ff https://gyazo.com/f7bf960e502202c16369c28d71ce03ff