How to make gui that follows a 3d position?

I’m trying to make a stealth/heist game and got stuck trying to make the detection bar system. I’m trying to make something like this:

robloxapp-20250204-1838524.wmv (1.1 MB)
(the detection bar)

I’ve searched for a few hours trying to look for a solution, but all I’ve come up with is a Vector3:Dot() system that’s seemingly ineffective.

local rs = game:GetService("RunService")

local frame = script.Parent.Frame
local target = workspace.Rig

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = workspace.CurrentCamera

rs.RenderStepped:Connect(function()	
	local unitDir = (char.PrimaryPart.Position - workspace.Rig.PrimaryPart.Position).Unit
	local mainDir = cam.CFrame.LookVector:Dot(unitDir)
	
	frame.Rotation = mainDir * 180
end)

this is what the code shows
robloxapp-20250204-1848169.wmv (2.0 MB)
Any help is appreciated!

1 Like

Try using a BillboardGui, it will always be at the position of an object in workspace you parent it under, and you can set an offset to the position if needed.

If you need the GUI always visible to the player, you can use the AlwaysOnTop property.

3 Likes

Those are called direction indicators. I recommend viewing this topic:

wow it works perfectly thank you

No worries! I would recommend googling first to check if what you want already exists.