Getting another Player's camera

To get current player’s camera :

local Camera = workspace.Camera
while true do
	wait()
	print(Camera.CFrame.Position)
end

How would I get another Player’s Camera.CFrame.Position?

3 Likes

I wonder if creating an IntValue with the value set to Camera.CFrame.Position would work

2 Likes

Yes, you could add a set of values in a folder that holds all of the player’s Camera position value.

1 Like

It didn’t. Players can’t change the value of an IntValue unless it’s inside of leaderstats. Also if they were able to, other clients won’t be able to see it.

1 Like

What do you want to do with the camera positions?

1 Like

To set a clients Camera.CFrame.Position as another clients Camera.CFrame.Position. But that will be a different problem

1 Like

Camera’s are loaded locally, so to do this you would need the Client to provide the camera’s location to the Server. You can use any remote device for this

2 Likes

ok, you probably know but if you wanted some sort of spectate type feature you could just set the cameras subject to the other player? It wouldn’t be exactly the same CFrame though.

If you want the exact CFrame exactly as the other player views it, I’d expect you need a remote event, to send the CFrame from one client to the server, and then read it from there. But it’s likely going to be a bit laggy

1 Like

What. Players(Client) can change the value of an IntValue at any times as long as it’s loaded per the client, no matter where it is, if something exists for the server then it exists for all clients, if something exists for a client then whether it exists for the server and other clients depends on whether that client created it

1 Like

No, this folder would only be accessible to the client if created by the client, therefor there would be no way to communicate it to the other client without going through the server, so you would have to have the server create the folder if you wanna do it that way

1 Like

I think it wasn’t working because I had another script messing with the values too

2 Likes

Example.rbxm (2.6 KB)
Here’s an example, I put some remote functions so it should be super easy for you to grab a player’s camera CFrame. I also put some notes on my code

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.