Minimap image move base off player position?
Asked by
7 years ago Edited 7 years ago
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
01 | module.RenderMinimap = function (gui) |
02 | local minimap = gui:WaitForChild( "Minimap" ) |
03 | local arrow = minimap:WaitForChild( "ImageLabel" ) |
04 | local mapImage = minimap:WaitForChild( "Frame" ):WaitForChild( "ImageLabel" ) |
06 | local player = players.LocalPlayer |
08 | local character = player.Character or player.CharacterAdded:wait() |
09 | local hrp = character:WaitForChild( "HumanoidRootPart" ) |
11 | runService:BindToRenderStep( "OffScreenIndicator" , Enum.RenderPriority.Camera.Value, function () |
12 | local rot = module.ReturnRot() |
13 | arrow.Rotation = ( 360 - math.floor(rot * 57.2 )) - 180 |
15 | local positionx = (minimap.AbsoluteSize.X - hrp.Position.X) - (mapImage.AbsoluteSize.X - minimap.AbsoluteSize.X/ 2 ) |
16 | local positiony = (minimap.AbsoluteSize.Y - hrp.Position.Z) - (mapImage.AbsoluteSize.Y - minimap.AbsoluteSize.Y/ 2 ) |
18 | mapImage.Position = UDim 2. new( 0 , positionx, 0 , positiony) |
How would i be able to fix this so when i size my screen it doesn't have a offset..