Correct. Sorry for the delay. The script would just use the world map model, getting the overall size of it, and convert that relative to the player position, giving you the scale position of the player relative to the mini-map frame.
Here is an image that might help with what I have explained thus far:
The problem with doing this is that the frame starts in the top-left (0, 0), however, the world map starts in the middle (0, 0). To get around this, we can just take the frame and make (0, 0) the middle of the frame, using math.
When converting the world position relative to the frame, we just have to subtract the relative position (player.Position/map.Size) from half of the size of the map ((map.Size/2)/map.Size).
Here is a script that should do everything that I have explained (Local Script, placed under the frame that represents the mini-map):
-- Mini Map Script
-- Constants
local PLAYER_COLOR = Color3.new(1,0,0)
local DOT_SIZE = UDim2.new(.05,0,.05,0)
local DOT_CORNER = UDim.new(1,0)
-- Variables
local run_service = game:GetService("RunService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local map: Frame = script.Parent
local world_map: Model = workspace.WholeMap
-- Functions
function Convert_Pos_To_Scale(position: Vector3): UDim2
return UDim2.fromScale(
(world_map:GetExtentsSize().X/2)/(world_map:GetExtentsSize().X) - position.X/world_map:GetExtentsSize().X,
(world_map:GetExtentsSize().Z/2)/(world_map:GetExtentsSize().Z) - position.Z/world_map:GetExtentsSize().Z
)
end
function Get_Player_Pos(selected_player: Player): Vector3
local character = selected_player.Character or selected_player.CharacterAdded:Wait()
return character.HumanoidRootPart.Position
end
function Create_Dot(position: UDim2, selected_player: Player)
local new_dot = map:FindFirstChild(selected_player.Name) or Instance.new("Frame", map)
local corner = Instance.new("UICorner", new_dot)
local aspect_ratio = Instance.new("UIAspectRatioConstraint", new_dot)
new_dot.Name = selected_player.Name
new_dot.BackgroundColor3 = PLAYER_COLOR
new_dot.Size = DOT_SIZE
new_dot.Position = position
corner.CornerRadius = DOT_CORNER
aspect_ratio.AspectRatio = 1
end
function Create_Map()
for _, selected_player in pairs(players:GetPlayers()) do
local selected_player_pos = Get_Player_Pos(selected_player)
local converted_pos = Convert_Pos_To_Scale(selected_player_pos)
Create_Dot(converted_pos, selected_player)
end
end
-- Initialize
run_service.RenderStepped:Connect(function(dt)
Create_Map()
end)
Let me know if you have any further questions or need help figuring out how to get this to work for you!
EDIT: Here are the results when I test it