I am making a camera script and have made it so it follows the player (in a 2D game). Although it is not the effect I hoped. It isn't really 2D when my player can move left, right, forward and backward with the camera following. I want my players to be able to do those things but not with the camera following them. So basically I want to make the camera only able to move left and right.
I was wondering if this is actually possible and if so, how?
Thanks!
local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera player.CharacterAdded:Wait() player.Character:WaitForChild("HumanoidRootPart") camera.CameraSubject = player.Character.HumanoidRootPart camera.CameraType = Enum.CameraType.Attach camera.FieldOfView = 70 game:GetService("RunService").Stepped:Connect(function() camera.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position) * CFrame.new(0,5,20) end)
I got it from a vid and added some stuff