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

How to lock Camera manipulation to one axis?

Asked by
alibix123 175
8 years ago

Say I only wanted the player to look up and down but not left and right, how would I go about doing that?

local runService = game:GetService('RunService')
local offset = Vector3.new(40,0,0)
local fieldOfView = 20
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
camera.FieldOfView = fieldOfView
local function onRenderStep()
    local playerPosition = player.Character.Torso.Position
    local cameraPosition = playerPosition + offset
    camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end

runService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onRenderStep)

This is my camera script but unforunately the player is not able to look up or down. And I'm not sure how to implement this.

0
First you would give us anything you've already tried. Uglypoe 557 — 8y
0
@Uglypoe Okay, I included my script alibix123 175 — 8y

Answer this question