(post no longer available)

This post is old and no longer being updated.

You can use these functions to get the computers position on the screen

	local camera = workspace.CurrentCamera
		local worldPoint = computer:GetPivot().Position
		local vector, onScreen = camera:WorldToScreenPoint(worldPoint)
		
		local screenPoint = Vector2.new(vector.X, vector.Y)
		ui.Position = UDim2.fromOffset(screenPoint.X, screenPoint.Y)
2 Likes

Adding on to this, you could add two attachments to opposite corners of the computer, the size and position the UI to match the attachments.

You could also have the UI inside a SurfaceGUI, so then it’s in 3D space and therefore always in the right spot, but it would be a little pixelated.

Sounds promising. But in my game, I have multiple computers, all of which open the Gui through a script running with client-side RunContext. Using your method, wouldn’t I have to somehow track every computer’s screen position when accessing one of the computers? Or is there a better way of doing it?

I was wondering about making it a SurfaceGui. My only concern with that, however, would be that the buttons on the computer screen can be interacted with by other players that are not using the computer.

1 Like

You can use a remote event to tell the client the position of the computer, when they enable a computer UI, don’t you already have a script to determine the computers position to setup the camera

Do you mean the position of the camera in front of the computer? Or are you referring to the position of the computer screen itself?

The computer, it should be pretty easy to get if you know the camera position

I would just create a remote event and fire the client with the computer position.