Im not very good at scripting to start off so pls be kind
The script I currently have allows for Z direction movement and has perfect camera position from player and facing direction. The only Issue is that when I move forward or backward it doesnt move at all, however follows the player when the player moves left or right. I want to make the camera move forward if the player does so too while keeping everything else working the same if possible, pls help me!
Here is my Camera script:
local runservice = game:GetService("RunService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local camera = workspace.Camera
local HEIGHT_OFFSET = 8
local CAMERA_DEPTH = 60
local function Camera()
local character = player.Character
if character then
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local RootPosition = humanoidRootPart.Position + Vector3.new(0, HEIGHT_OFFSET, 0)
local cameraPosition = Vector3.new(-CAMERA_DEPTH ,RootPosition.Y, RootPosition.Z)
camera.CFrame = CFrame.lookAt(cameraPosition, RootPosition)
end
end
runservice:BindToRenderStep("SidescrollingCamera", Enum.RenderPriority.Camera.Value + 1, Camera)