Custom Camera Script is Not Working, Argument 3 Missing?
I followed the wiki on how to create a custom camera script and it seems it isnt working. I was wondering if anyone here could help me out a little.
Here is the code
01 | local cameraHeight = 12 |
02 | local cameraZOffset = 20 |
03 | local cameraXChase = 10 |
04 | local cameraSpeed = . 25 |
06 | local camera = game.Workspace.CurrentCamera |
07 | local player = game.Players.LocalPlayer |
08 | local RunService = game:GetService( 'RunService' ) |
10 | local function setupCamera() |
11 | camera.CFrame = CFrame.new(Vector 3. new( 0 ,cameraHeight,cameraZOffset), Vector 3. new( 0 ,cameraHeight, 0 )) |
15 | player.CharacterAdded:connect(setupCamera) |
17 | local function onUpdate() |
18 | if player.Character and player.Character:FindFirstChild( 'Torso' ) then |
19 | local playerX = player.Character.Torso.Position.X |
20 | local cameraX = camera.CFrame.p.X |
22 | if cameraX - cameraXChase < playerX then |
23 | camera.CFrame = camera.CFrame + Vector 3. new(cameraSpeed, 0 , 0 ) |
28 | RunService:BindToRenderStep( 'Camera' , Enum.RenderPriority.Camera.Value, onUpdate()) |
Its a LocalScript under StarterPlayer.StaterPlayerScripts. And its like its not finding the torso.
The output says at line 28 (The last line after end) It says Argument 3 missing or nil? I have never had this before?