Is this code correct? (Its for 2d camera.)
I asking it because this code was wrote by AI(I can code and understand it but im not a pro. I can write dialog but not something like camera system or 2d movement.)
I think theres nothing wrong, but i never fully trust them.
Theres the code:
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local function setupCamera(character)
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 30
local root = character:WaitForChild("HumanoidRootPart")
game:GetService("RunService"):BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, function()
camera.CFrame = CFrame.new(root.Position + Vector3.new(0, 15,50), root.Position)
end)
end
if player.Character then
setupCamera(player.Character)
end
player.CharacterAdded:Connect(setupCamera)
Have a nice day!