i've tried putting this script to make it scroll left, but it didn't work

local cameraHeight = 12
local cameraZOffset = 20
local cameraXChase = 10
local cameraXOffsetChase = 10
local cameraSpeed = .25
 
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
 
local function setupCamera()
	camera.CFrame = CFrame.new(Vector3.new(0,cameraHeight,cameraZOffset),
										Vector3.new(0,cameraHeight,0))
end
setupCamera()
player.CharacterAdded:connect(setupCamera)
 
local function onUpdate()
	if player.Character and player.Character:FindFirstChild('Torso') then
		local playerX = player.Character.Torso.Position.X
		local cameraX = camera.CFrame.p.X
 
		if cameraX - cameraXChase < playerX then
			camera.CFrame = camera.CFrame + Vector3.new(cameraSpeed, 0, 0)
		end
	end
end
 
RunService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onUpdate)

2 comments

0

Could you please be more specific about what you are trying to do, showing me a 30 lined script does not exactly tell me what your issue is.

0

so i am making a platformer, and i would like to make the script scroll to the left when the player goes to the left of the camera, since it only does it for the right.