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?