Help Fixing FPS Viewmodel Script

What do I want to achieve?
I’m trying to attach an FPS viewmodel to a player’s camera.

What is the issue?
My script that is meant to attach the viewmodel to the camera is not working properly, or that’s at least what I’m assuming.

What solutions have I tried so far?
I have tried rewriting my code, different viewmodels, placing my script in different places, changing my script from LocalScript to Script, and getting help from a fellow dev.

My script (this is the only script – LocalScript – in the game so far, it’s in the StarterCharacterScripts):

local camera = game.Workspace.CurrentCamera;
local humanoid = game.Players.LocalPlayer.CharacterAdded:Wait():WaitForChild("Humanoid");

local viewModel = game.ReplicatedStorage:WaitForChild("viewModel"):Clone();

local function onDied()
	viewModel.Parent = nil;
end

local function onUpdate(dt)
	viewModel.Head.CFrame = camera.CFrame;
end

humanoid.Died:Connect(onDied);
game:GetService("RunService").RenderStepped:Connect(onUpdate);

Setup:

Result:

Output (no errors):
image

Thanks in advance.

From what I see here, the parent of viemodel is not set.

The parent is the ReplicatedStorage.

Objects in replicated storage are not visible to the viewport. The parent of the viewmodel is not set to its proper position in workspace.

I think you forgot to parent the cloned ViewModel to the camera