Hi, I've having fun making a minimap. I have everything working (the dots appearing at correct distances) except I don't know how to change the position of the dot based on which way the player is looking. I'm assuming I'll have to use the player's head's look vector, but how should I make the dots on the map position according to that?
local player = script.Parent.Parent.Parent.Parent
local head = player.CharacterAdded:wait().Head
local players = game.Players:GetChildren()
repeat wait() until player.Character.Torso
local torso = player.Character.Torso
local target = nil
function x()
return (torso.Position.X - torso2.Position.X)
end
function y()
return (torso.Position.Y - torso2.Position.Y)
end
while wait(5) do
for i = 1, #players do
target = players[i]
print("MINIMAP target:"..target.Name)
torso2 = target.Character.Torso
if (torso.Position - torso2.Position).magnitude <= 100 then
f = Instance.new("Frame", script.Parent.Parent.GUI)
f.BackgroundColor3 = Color3.new(255, 255, 255)
f.BorderSizePixel = 0
f.Size = UDim2.new(0, 5, 0, 5)
f.Position = script.Parent.Position + UDim2.new(0, 50, 0, 50) - UDim2.new(0, 2.5 , 0, 2.5) + UDim2.new(0, x(), 0, y()) -- this is where the frame is positioned in case you can't tell
script.Parent.BackgroundTransparency = 0.7
if i == #players then -- I just realized I don't need this here. Don't judge ;_;
wait(5)
dots = script.Parent.Parent.GUI:GetChildren()
for i = 1, #dots do
dots[i]:Destroy()
end
end
end
end
end
while wait(10) do
for i = i, #players do
print("Player:"..players[i])
end
end
Thanks for any help, LightArceus

2 comments
I just got the time to sit down and study this, sorry XD Anyway, I need to rotate the minimap according to the player's heading, and I get the heading from the CFrame of the one of the player's parts. I'm a little bit confused about the wiki article "Converting CFrame into heading, attitude and bank" (the last but of code on the page) because it isn't in any context. How would I implement that?
Basically all you have to do is copy the components() line and the heading line. Where is says 'matrix' in the components line, just replace that with Character.Head.CFrame