Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make it so a player can't rotate their camera?

Asked by 8 years ago

So I have a script that locks the player's camera to a part:

while wait() do
    game.Workspace.CurrentCamera.CameraSubject = workspace.camerapart
end

and I have the min/max camera distance set at 10, but the player is still able to rotate the camera using the right click. So, how can I make it so a player can't rotate their camera?

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

The best way to disable this is setting Camera's type to Scriptable. Player won't be able to move it and buttons such as "o", "i" won't work (Normally these buttons works as zoom out and zoom in). Sadly setting Camera's subject like that won't work. You will have to use CFrame.

while wait() do
    game.Workspace.CurrentCamera.CFrame = workspace.camerapart.CFrame -- CFrame
end

0
Thank you! KeepItCoded 10 — 8y
0
Glad I could help! Make sure to accept my answer :) personal_ly 151 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

You can also use the event .RenderStepped if you want to keep a certain CameraType other than 'Scriptable'.

http://wiki.roblox.com/index.php?title=API:Class/RunService/RenderStepped

Answer this question