How would I make a GUI that can display a players viewpoint?

hello, I need to make a GUI that can display the characters perspective. I assume this could be done with VeiwportFrames, however I am having trouble porting the cameras view into the frame. Anyone know how I can solve this? Thanks in advance!

you don’t need camera for that. use the character’s primary part orientation

What I mean is seeing exactly what they see. Almost as if they are streaming their roblox client onto the TV.

Please excuse my poor drawing skills, but this is a example. The stick figure is the player, with the floating orb being the camera and the cone coming off it being the cameras perspective. Above the player and camera, you can see the TV, which is displaying exactly what the player’s client sees. In this case, it displays the player.

You can use a ViewportFrame to render 3D objects in a 2D display. It also has a camera property that can be set to a camera. In this case, you’d create a proxy camera of which you’d update its CFrame with the CFrame of the target player’s camera’s CFrame. However, that isn’t accessible outside of the target player’s client, so you’ll have to use a remote to constantly have the target player fire with their current camera’s CFrame. Now the part that makes this a bit unrealistic is you’d need to duplicate every part that’s visible to the camera in the workspace, or duplicate everything. This means that the camera is rendering the world twice, or at least part of it twice if you use the former method. Also you should tween the camera CFrame updates so that the camera updates aren’t jittery and more smooth. I would recommend a short tween for that.

1 Like

then, you need to create a camera (‘Camera’)) and set viewport frame’s current camera. after that just make the script updating camera’s cframe

Hey, thanks for the reply! I plan on using RenderStepped To fire the remote in order to minimize choppy video. I also am guessing that cloning the entire workspace will cause a high amount of lag, so you think using WorldToViewportPoint To only clone what is on the players screen would minimize that? If that still causes noticeable lag, I could potentially swap RenderStepped for a one second delay, and delay the entire view by a few seconds. That way I will know the next camera position before I move to it, and so I can tween 1 camera point to the next.

RenderStepped is fine, but it won’t make it smoother. It’ll just create more points to work with. You’ll still have to smooth the positions on the viewer’s client, to smooth the transitions between the points given. Also you won’t have to duplicate things every frame. But even if you don’t clone everything, you’ll still have to iterate through the entire workspace to determine what’s in view and what’s not. You could use some of the new spacial query techniques, but it can still be quite intensive. You could probably handle this even better with Parallel Lua, but that is a whole different subject.

I’m confused on how exactly I would go about smoothing the different points, and why I even need to if I’m updating every frame. I know remote events have delay on them, However I doubt that would lead to large performance issues.

Because it’s going through two different signals, and not every signal will be taken. What I mean is that you’re not actually going to be getting every frame like you’d expect. You might even get frames out of order. You can Tween the latest signal to the last position, along with a short tween time, and it’ll look much smoother.

Another proof of example is the replication of server physics to any given client. Normally the physics is handled by one specific player (decided dynamically). But if the physics are handled by the server or another player than the viewing player, it will look jittery even though it’s being updated every frame.

There’s a gif example I’d post, but I can’t seem to find it for some reason.

Here are some related articles:

1 Like

The problem I have with tweening it is that there will be a lot of moving objects, so I will need to tween each of them individually. Not only that, but I also sending signals out of order could mess up the tweens.

This is close to what I want, I will try to modify it so it replicates to other clients and also includes everything in the workspace.

No, you would only tween the proxy camera. None of the parts have to move.

1 Like

hey, I really like how this works, and it is potentially the solution to my problem. The only issue Im having with it is the fact that it does not render animations properly, and so it looks odd. Is there any way I can add animations into it so it works like I want it to?

I revised the script slightly so that animations are replicated. Humanoid:MoveTo doesn’t work in WorldModels so the ‘CFrame’ property of each of the character’s parts needs to be set every frame.

local run = game:GetService("RunService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
if not player:HasAppearanceLoaded() then player.CharacterAppearanceLoaded:Wait() end

local clientCamera = workspace.CurrentCamera
local gui = script.Parent
local viewportFrame = gui:WaitForChild("ViewportFrame")
local worldModel = viewportFrame:WaitForChild("WorldModel")
local viewportCamera ="Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame


character.Archivable = true
local characterClone = character:Clone()
characterClone.Parent = worldModel
characterClone.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None

	for _, descendant in ipairs(character:GetDescendants()) do
		if descendant:IsA("BasePart") then
			local descendantClone = characterClone:FindFirstChild(descendant.Name, true)
			if descendantClone then descendantClone.CFrame = descendant.CFrame end
	viewportCamera.CFrame = clientCamera.CFrame

Model.rbxm (8.9 KB)


You can use VieportFrames and set their current camera (viewportFrame.CurrentCamra) to the player’s camera (Workspace.CurrentCamera)

Thank you again! All I need to do now is figure out how to replicate workspace into the frame, I can do that though as it shouldn’t be as hard.

I was talking about displaying another player’s camera than the viewing player.

1 Like