Wondering how to attach the player's camera to a npc head locally

So, What I want to do is make it so that the player’s camera is attached to a dummy when an animation plays, so that the player can see the view of the dummy when the animation is playing, for it to stop when the animation stops, like a glory kill used in Undead Nation. I want to also mention that I need help on putting the player’s camera view on a separate part, which is the dummy’s head.

[i wanted it to look like this]

[and here’s the script. that ill change later when I get the chance to]

wait()
local Humanoid = script.Parent.Humanoid
Humanoid.BreakJointsOnDeath = false
local DA = Instance.new("Animation")
DA.AnimationId = "rbxassetid://ID"
local DeathAnimation = Humanoid:LoadAnimation(DA)
local camera = game.Workspace.CurrentCamera
local dummy = script.Parent

Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 0 then
		print("Died")
		script.Parent.HumanoidRootPart.Anchored = true
		script.Parent.Head.SelectionBox.Visible = true
		script.Parent.Torso.ProximityPrompt.Enabled = true
		local function onTouched(hit)
			local human = hit.Parent:FindFirstChild('Torso')
			if (human ~=nil) then
				script.Parent.HitBox:Destroy()
				script.Parent.BackHitBox:Destroy()
				script.Parent.Head.SelectionBox.Visible = false
				human.Anchored = true
				human.Parent.HumanoidRootPart.CFrame = script.Parent.HumanoidRootPart.CFrame + Vector3.new(0,0,2)
				script.Parent.PlayerLeft.Transparency = 0
				script.Parent.PlayerLeft.BrickColor = human.Parent:FindFirstChild("Left Arm").BrickColor
				script.Parent.PlayerRight.Transparency = 0
				script.Parent.PlayerRight.BrickColor = human.Parent:FindFirstChild("Right Arm").BrickColor
				DeathAnimation:Play()
				wait(.6)
				script.Parent.grab:Play()
				wait(.7)
				script.Parent.Crack:Play()
				script.Parent.blood:Play()
				wait(.8)
				script.Parent.PlayerLeft.Transparency = 1
				script.Parent.PlayerRight.Transparency = 1
				human.Anchored = false
				wait(2)
				human.Anchored = false
				script.Parent:Destroy()
			end
		end
		script.Parent.Torso.ProximityPrompt.Triggered:connect(onTouched)
	end
end)

The thing is that I either can’t find the right topic for this, or when I find the right topic, it just doesn’t work.

I’m using a glory kill template cause I’m lazy, but none of the others have cameras including the one I’m using. I really need help on this, so if you can I would appreciate it.

Super easy.

local camera=game.Workspace.CurrentCamera
local dummy=game.Workspace.Dummy
repeat camera.CameraSubject=dummy.Humanoid until camera.CameraSubject==dummy.Humanoid

I forgot to mention that I want the camera to be on a separate camera part like the dummy’s head, and not the entire humanoid or body. But sadly I couldn’t get this to work, do you have any other solutions I can use?

setting camerasubject to the dummies humanoid will set it similar to if you have your camera on your player. AKA you can zoom in and out on the head.

Also can you show me the error

Alright, give me a second, I just need to get into roblox studio real quick.

Turns out the error was for a different thing that was messing with the script, Thanks for being the only one to help me.

The only thing that I needed to do left was to change the camera type to scriptable and put it as a seperate local script if its possible.