function WorldToScreen(Object , at)
local viewportFrame = Object.Adornee.Parent.Parent
local viewportCamera = viewportFrame.CurrentCamera
local point = viewportCamera.CoordinateFrame:pointToObjectSpace(at)
local aspectRatio = viewportFrame.AbsoluteSize.X/viewportFrame.AbsoluteSize.Y
local hfactor = math.tan(math.rad(viewportCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
--
local x = (point.x/point.z) / -wfactor
local y = (point.y/point.z) / hfactor
--
return Vector2.new(viewportFrame.AbsoluteSize.X*(0.5 + 0.5*x), viewportFrame.AbsoluteSize.Y*(0.5 + 0.5*y))
end

That doesn’t work with viewports, because all cameras except the ones in the workspace are deleted, and if i make a camera with a script, it’s viewportsize is always 1,1 which breaks that function.