Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How do I make every player's camera face a certain direction?

Asked by 8 months ago

In my game, when players are teleported to a level, their cameras don't face forward, so there comes times where they are completely turned around when the level begins. I simply want to turn everyone's camera to a certain coordinate, (0,90,0) for example. I understand that there was an update for ROBLOX studio that rearranged the contents in 'Player', so I would like an up to date solution for this problem.

0
CFrame(position Vector3, look at Vector3) is all you need to make a CFrame at a position looking towards the other vector position kingdom5 5372 — 8mo

1 answer

Log in to vote
0
Answered by 4 months ago

I figured it out. The trick is to give every player a local script that turns their camera. I used an "in pairs" for loop to cycle through every player currently in the game and copy the local script into their character scripts, like so (the local script is named 'Turn'):

--this code goes in a normal script. for i,v in pairs (game.Players:GetChildren()) do script.Turn:Clone().Parent = v.character wait() end

Once the players have the local script, it will turn their cameras immediately. 'Turn' holds this simple code:

workspace.CurrentCamera.CFrame = CFrame.Angles(0,90,0)

Ad

Answer this question