Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make horizontal camera movement?

So I'm trying to create camera movement like in DooM 1-2, and I made this local script

player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CameraSubject = Character.Head
Camera.CFrame = Character.Head.CFrame

Of course I did it wrong, how can I make the camera move horizontally? (Using the mouse.)

1 answer

From my experience making custom camera systems, a first person shooter requires a custom controls and camera system.

The reason why your provided script doesn't work at all is because you aren't changing your camera's CFrame every frame. You can try BindOnRenderStep, but you will get unwanted results with the controls (e.g camera going crazy when going backwards.)

In order to create a custom camera and controls systems, you must overwrite the default camera and controls scripts.

In order to overwrite these, you must place two localscripts named CameraScript and ControlScript in game.StarterPlayer.StarterPlayerScripts.

If you need guidance on the controls system, you can go by my game's control script here.

If you need more personal help, join the ScriptingHelpers discord and ping me at kernelmode#0213.

This discussion is preserved as it was. New answers, comments, and votes are closed.