Please note this is my first post, so if there is anything that needs redone, or said a different way, please let me know.
What do I want to achieve?
I want to make a mini map that works similar to the islands’ treasure map.
Basically a mini map that tracks the player’s character’s position and displays that onto a UI object.
What is the issue?
I can’t seem to figure this out. I have tried, calculated, and tried again, but it is still not working. So maybe you can help.
I have a 250 by 250 stud map, and a UI frame. So I need to display the character’s position’s X and Y into a UI object’s Position’s X and Y scale.
What solutions have you tried so far?
I have tried all the normal things. I have searched for related articles on the devforum. When I could not find anything useful, I turned to YouTube tutorials, again all they had was a small mini map that follows the player’s character. What I need is a map that does not move. Only the character’s icon moves on it. I also have tried to put a part into the ViewPortFrame and set it to the player’s character’s position. This causes a lot of lag.
after many hours, this is the best got:
local textlabel = script.Parent.TextLabel
local player = game.Players.LocalPlayer
while wait(1) do
local character = player.Character
local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
local position = HumanoidRootPart.Position
textlabel.Position = UDim2.new(position.X/101.125,0,position.Z/101.125,0)
end
end
local textlabel = script.Parent.TextLabel
local player = game.Players.LocalPlayer
local MapGUIsize = ???
while wait(1) do
local character = player.Character
local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
local X =HumanoidRootPart.Position.X/125 --- divided by 125 as that is half the map size.
local Y = HumanoidRootPart.Position.Z/125
local position = HumanoidRootPart.Position
textlabel.Position = UDim2.new(X,0,Y,0)
end
end
Make sure that the anchor point of the pointer is at vector2.new(0.5,0.5)
local textlabel = script.Parent.TextLabel
local player = game.Players.LocalPlayer
local MapGUIsize = ???
while wait(1) do
local character = player.Character
local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
local X =(HumanoidRootPart.Position.X+125)/250
local Y = (HumanoidRootPart.Position.Z+125)/250
local position = HumanoidRootPart.Position
textlabel.Position = UDim2.new(X,0,Y,0)
end
end
local textlabel = script.Parent.TextLabel
local player = game.Players.LocalPlayer
local MapSize = 500
while wait(1) do
local character = player.Character
local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
local X =(HumanoidRootPart.Position.X+(MapSize/2))/MapSize
local Y = (HumanoidRootPart.Position.Z+(MapSize/2))/MapSize
local position = HumanoidRootPart.Position
textlabel.Position = UDim2.new(X,0,Y,0)
end
end