Alright, I have edited my code:
local camera = workspace.CurrentCamera
while true do
wait()
local pos = camera:WorldToScreenPoint(workspace.TestPart.Position)
local screenpoint = Vector2.new(pos.X,pos.Y)
script.Parent.Position = UDim2.new(screenpoint)
end
its a lot better, but the frame wont move. when I put print(screenpoint), it returns with coordinates with where the frame would go, but when I change its position to screenpoint, it doesn't move at all. Why is this?

4 comments
ill try to use this
ok i edited my question if you could tell me why my code wont work that would be nice
you can't create a UDim2 with a Vector2, you have to manually put UDim2.new(0, vector.X, 0, vector.Y)
you can't create a UDim2 with a Vector2, you have to manually put UDim2.new(0, vector.X, 0, vector.Y)