Hi, I’m trying to script a minimap in-game. The image is supposed to move based on the player’s position but when I play the game, the map’s position is moved off the frame. The map moves according to my position, it’s just too far from the frame for some reason.
Expectation:
Reality:
Code:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local minimap = script.Parent.Parent
local mapImage = minimap:WaitForChild("Container"):WaitForChild("Map")
local hrp = character:WaitForChild("HumanoidRootPart")
game:GetService("RunService"):BindToRenderStep("OffScreenIndicator", Enum.RenderPriority.Camera.Value -1, function()
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)
I did, its nothing abnormal. Its like 11.blabla, 0,30.blabla,0 and the position updates as the player moves. The image is just too far away for some reason.
Try changing this so you instead fetch the minimap with starterplayer folder instead. I’ve had some problems with images before and this solved it sometimes.
Moving forward seems to move backwards on the map, any way to reverse the up-down axis? I tried changing to the negative signs and etc. but doesn’t work