I'm not experienced with camera manipulation, but I tried to make a 2D camera script. By this, I mean I want the camera to look at the side of the character, thus making a 3D space look two dimensional.
wait(1) local plr = game.Players.LocalPlayer local cam = workspace.CurrentCamera local chr = plr.Character cam.CameraType = "Scriptable" cam.CameraSubject = nil while true do wait() cam.CoordinateFrame = chr.Torso.CFrame * CFrame.new(10,0,10) cam.Focus = CFrame.new(chr.Head.Position) cam:PanUnits(50) end
This sort of works, but it also prevents my character from moving to the right, it can only move to the left. I can press A, but it doesn't work if I press D. I also would like to find a way other than a while loop, because it makes the game look unpolished (If you try to move the camera it behaves is a jerky manner).
Any wiki links would also be appreciated.
I'm not too sure, but I'll take a challenge.
For a replacement on the while loop, try using the RenderStepped event in the RunService, that should stop the "jerking".
For the movement problem, I would not use the PanUnits method and would instead weld an invisible part to a part of the player's character, with Part0 being the torso, Part1 being the invisible part, C0 being CFrame.new() and C1 being a CFrame that would make the invisible part move away from Part0's position so that it's side on with the character. Then I'd make the CoordinateFrame of the camera the invisible part and the focus of the camera the torso or the head, whichever you choose.
Sorry if this confused you, I tried my best to make it as clear as possible.
Example of the welding:
local weld = Instance.new("Weld",chr.Torso) weld.Part0 = chr.Torso weld.Part1 = game.Workspace.PARTNAME --Where PARTNAME is the name of the invisible part. weld.C0 = CFrame.new() --Position of Part0 when C0 is added to Part0's CFrame, which would equal Part0's CFrame. weld.C1 = CFrame.new(10,0,0) --Example CFrame, change as needed. Would be 10 studs from the X axis of Part0's CFrame + C0.