Attempting to make a radar system

Hello! I’m trying to make a radar system on a SurfaceGui, but at this point I don’t even know what I’m doing.

local soul = workspace.soul.MeshPart
local tool = script.Parent
local screen = tool.radarscreen
local Text = screen.SurfaceGui.TextLabel
local radarBG = screen.SurfaceGui.Background

local Artifact = screen.SurfaceGui.Background.Artifact
local multiply = 1/200


game:GetService("RunService").RenderStepped:Connect(function()
	local uiAspectRatioConstraint = Instance.new("UIAspectRatioConstraint", radarBG)
	local offset = screen.Position - soul.Position
	offset = offset * multiply
	Artifact.Position = UDim2.new(offset.X + 0.5, 0, offset.Y + 0.5, 0)
end)


while wait(2) do
	local distance = (screen.Position - soul.Position).Magnitude
	Text.Text = math.floor(distance)
end

Could you explain whats the specific behavior the radar should use?
By a quick read of the code I suppose you are not tracking a position on a map, more like tracking the position in order to point towards the objective?

Oh, it’s supposed to be a dot on the radar

https://gyazo.com/ce147e48ad14f0195b8d8364c59e2fb2

I’ve gone ahead and made this a community tutorial, maybe someone else can make use of it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.