ViewModel Camera doesn't shake with camera during animation

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want camera to shake with the animation. But when I play animation it doesnt even move in game

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried everything I can, asked questions Rodevs and Hidden devs server and i got ignored, made a reddit post too but didn’t get help yet. Tutorials on youtube don,t include any information about script with view model. they either end after teaching how to animate or use free model scripts. I’ve looked for more than 12 hours but still got nothing

please tell me if there is any way to script or make it so camera shake like its supposed to (like the exported animation)
Script for animating viewmodel:

local tool = script.Parent
local handle = tool.Handle
local player = game.Players.LocalPlayer
local char =  player.Character or player.CharacterAdded:Wait()
local camera = workspace.Camera
local VM = camera:FindFirstChild("Viewmodel")
print("hi")
local phumanoid = VM:FindFirstChild("Humanoid") -- Humanoid in viewmodel
local humanoid = char:WaitForChild("Humanoid")
local atk1 = phumanoid:LoadAnimation(script:WaitForChild("Swing1"))
local atk2 = phumanoid:LoadAnimation(script:WaitForChild("Swing2"))
local atk3 = phumanoid:LoadAnimation(script:WaitForChild("Swing3"))

local swordh = tool:WaitForChild("WeaponHandler")


local WS = humanoid.WalkSpeed
local JH = humanoid.JumpHeight

local click = 1
local lastclick = 1
local timeBetween = char:FindFirstChild("PlayerStatsFolder").CooldownVal.Value

local debounce = false

	tool.Activated:Connect(function(isTyping)
		if isTyping then return end
		if humanoid.Health == 0 then return end

		if not debounce then
			debounce = true

			


			if click >= 3 then

				click = 1
				swordh:FireServer(true)
				humanoid.WalkSpeed = 0
				humanoid.JumpHeight = 0
			atk3:Play()

				click += 1

				humanoid.AutoRotate = false

				wait(0.25)



				humanoid.WalkSpeed = WS
				humanoid.JumpHeight = JH

				humanoid.AutoRotate = true




			elseif click == 1 then

				swordh:FireServer(false)

				humanoid.WalkSpeed -= 10
				humanoid.JumpHeight = 0

				humanoid.AutoRotate = false

			atk1:Play()

				click += 1


				wait(0.25)

			

				humanoid.WalkSpeed = WS

				humanoid.AutoRotate = true



			elseif click == 2 then

				swordh:FireServer(false)

				humanoid.WalkSpeed -= 15

				humanoid.AutoRotate = false

			atk2:Play()

				click += 1

				wait(0.5)

			

				humanoid.WalkSpeed = WS + 7

				humanoid.AutoRotate = true



			end

			wait(timeBetween)

			debounce = false

			wait(3)
			lastclick = click
		end
	end)


	while true do

		wait(6)

		if lastclick == click then
			click, lastclick = 1,1
			humanoid.JumpHeight = JH
			humanoid.WalkSpeed = WS
		end

	end

that script ends here

second script:
Script that shows viewmodel on screen:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.Camera
local runservice = game:GetService("RunService")

local VM = game.ReplicatedStorage.Viewmodel:Clone()
VM.Parent = camera

runservice.RenderStepped:Connect(function()
	if player.Character:WaitForChild("Humanoid").Health == 0 then 
		if camera:FindFirstChild("Viewmodel") ~= nil  then
		camera.Viewmodel:Destroy()
		end
	end
	
	if camera:FindFirstChild("Viewmodel") ~= nil  then
		camera.Viewmodel:SetPrimaryPartCFrame(camera.CFrame * CFrame.new(0.025, -0.5, -2.5)* CFrame.Angles(0.05, 0, 0))
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.