I’m not sure if there’s a better approach, there’s a good chance that there might be, but this would do something similar to that:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Rig = workspace.Rig
local Camera = workspace.CurrentCamera
local pivot = Rig:GetPivot()
local position = pivot.Position
local lookVector = pivot.LookVector
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = Players.LocalPlayer.PlayerGui
local frame = Instance.new("Frame")
frame.Parent = screenGui
RunService.RenderStepped:Connect(function()
local upperTorso = Rig.UpperTorso
local topLeft = upperTorso.Position - upperTorso.Size/2
local bottomRight = upperTorso.Position + upperTorso.Size / 2
local leftScreenPoint = Camera:WorldToScreenPoint(topLeft)
local rightScreenPoint = Camera:WorldToScreenPoint(bottomRight)
frame.Size = UDim2.fromOffset(rightScreenPoint.X - leftScreenPoint.X, rightScreenPoint.Y - leftScreenPoint.Y)
frame.Position = UDim2.fromOffset(leftScreenPoint.X, leftScreenPoint.Y)
end)
You’ll have to make this code work with your system, and of course disconnect the RenderStepped connection whenever this UI shouldn’t be visible! But this should be able to help get you started, best of luck!