I am trying to make a top down camera script yet it is not working. The error is on line 13 and the error message is:
Players.adieking1.PlayerScripts.CameraScript:13: invalid argument #2 (Vector3 expected, got CFrame)
Script:
game:GetService("ControllerService"):ClearAllChildren() repeat wait() until game.Players.LocalPlayer.Character local char = game.Players.LocalPlayer.Character local cam = game.Workspace.CurrentCamera cam.CameraType = Enum.CameraType.Scriptable cam.FieldOfView = 70 Spawn(function() while true do game:GetService("RunService").RenderStepped:wait() cam.CoordinateFrame = CFrame.new(char.HumanoidRootPart.Position + Vector3.new(5, 10, -5) , char.HumanoidRootPart.Position)+ CFrame.Angles(0,0,0)-- Please note that the Angles part is for after the script works so I can adjust it then. end end)
Please ask if you need any more information.
Use multiplication to add up two CFrames:
game:GetService("ControllerService"):ClearAllChildren() repeat wait() until game.Players.LocalPlayer.Character local char = game.Players.LocalPlayer.Character local cam = game.Workspace.CurrentCamera cam.CameraType = Enum.CameraType.Scriptable cam.FieldOfView = 70 spawn(function() while true do game:GetService("RunService").RenderStepped:wait() local pose = char.HumanoidRootPart.Position + Vector3.new(5, 10, -5) local lookAt = char.HumanoidRootPart.Position cam.CFrame = CFrame.new(pose , lookAt) * CFrame.Angles(0,0,0)-- Please note that the Angles part is for after the script works so I can adjust it then. end end)