Basically I just don't want the player to be able to rotate their camera. I've tried setting the CFrame of the camera in a loop but that stops any movement at all.
Can't seem to find a good solution.
Basically I just don't want the player to be able to rotate their camera. I've tried setting the CFrame of the camera in a loop but that stops any movement at all.
Can't seem to find a good solution.
If you wish to only edit camera movement, replace the default CameraScript with the following code (in other words, insert the following into a LocalScript named CameraScript parented under the StarterPlayerScripts folder):
RunService = game:GetService("RunService")
player = game.Players.LocalPlayer
camera = workspace.CurrentCamera
character = nil
rotation = Vector3.new() --set the defualt camera rotation (must be in degrees)
offset = Vector3.new() --set the distance the camera should be from the players head
player.CharacterAdded:connect(function(char)
character = char
end)
RunService:BindToRenderStep("Camera", 200, function()
if character and character.Head then
camera.CFrame = character.Head.CFrame+CFrame.new(offset)*CFrame.Angles(Vector3.new(math.rad(rotation.X), math.rad(rotation.Y), math.rad(rotation.Z)))
end
end)
I didn't test the script, but it should work.
game:GetService("ContextActionService"):UnbindAllActions()
This discussion is preserved as it was. New answers, comments, and votes are closed.