Help with camera script

I’m trying to do something to change the camera to a new character, how will I get this to work?

Yes, it’s via a tool but that shouldn’t matter.

script.Parent.Equipped:Connect(function()

local plr = game.Players.LocalPlayer.Character

game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable

game.Workspace.Camera.CameraSubject = game.Workspace:WaitForChild("Ralsei (".. plr.Name .. ")"):WaitForChild("Humanoid")

game.Workspace.Camera.CameraType = Enum.CameraType.Custom

end)
Extra Information

Script Type: LocalScript
Script Parent: Tool

Instead of doing “Camera” do “CurrentCamera”.

Use variables.

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local camera = workspace.CurrentCamera — always use CurrentCamera to reference the camera
local tool = script.Parent

tool.Equipped:Connect(function() 
    
    camera.CameraType = Enum.CameraType.Scriptable
    camera.CameraSubject = workspace:WaitForChild(object):WaitForChild("Humanoid")
    camera.CameraType = Enum.CameraType.Custom

end)

Wow. That worked. I wonder what the big difference was? Thanks!