Viewmodel works slow

So, i was making a viewmodel script that transforms it to Neck position and torso+camera X rotation. And when i launch it, it looks something like this:
When you move camera really fast, it lags behind. Im pretty sure its because of *Cframe.Angles() in the script and it takes time to procedure/render it, so im asking for help to find the solution. Here is the script

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:FindFirstChild("Head") or character:WaitForChild("Head")
local torso = character:FindFirstChild("Torso") or character:WaitForChild("Torso")
local viewmodel = game.ReplicatedStorage.viewmodel_3rd_person
local colors = character:WaitForChild("Body Colors")
local shirt = character:WaitForChild("Shirt")
local cgun
local decrease = 1.2
if colors then colors:Clone().Parent = viewmodel end
if shirt then shirt:Clone().Parent = viewmodel end
repeat wait() until game:IsLoaded()
for i,v in pairs(character:GetChildren()) do
	if v:IsA("CharacterMesh") then
		--print("found mesh")
		if v.BodyPart == Enum.BodyPart.LeftArm or v.BodyPart == Enum.BodyPart.RightArm then
			--print("mesh belongs to arm")
			v:Clone().Parent = viewmodel
script.EquipGun.Event:Connect(function(gun : Model, anim : string)
	script.ShowViewmodel.Value = true
	local clone = gun
	local handle = gun:FindFirstChild("Handle")
	handle.Anchored = false
	local grip = viewmodel["Right Arm"].Grip
	--clone.Parent = viewmodel
	local weld ="Weld",viewmodel)
	weld.Part0 = handle
	weld.Part1 = grip
	--weld.Enabled = true
	--handle.CFrame = grip.CFrame
	--cgun = gun
	--print(viewmodel["Right Arm"].Grip.WorldCFrame)
--Enum.RenderPriority.Camera.Value = 1
game:GetService("RunService"):BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, function(deltaTime)--game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	local show = script.ShowViewmodel.Value
	local x,y,z = game.Workspace.CurrentCamera.CFrame:ToOrientation()
	viewmodel.HumanoidRootPart.CFrame = torso.NeckAttachment.WorldCFrame
	if show then
		viewmodel.Parent = workspace
		--viewmodel.HumanoidRootPart.CFrame =
		--* CFrame.Angles(x,0,0) --game.Workspace.CurrentCamera.CFrame.Rotation
		local lh = character:FindFirstChild("Left Arm")
		local rh = character:FindFirstChild("Right Arm")
		--[[if cgun then
			cgun.Handle.CFrame = viewmodel["Right Arm"].Grip.CFrame
		if lh and rh then
			lh.LocalTransparencyModifier = 1
			rh.LocalTransparencyModifier = 1
			print("disabled transparency")
		viewmodel.Parent = game.ReplicatedStorage
		local lh = character:FindFirstChild("Left Arm")
		local rh = character:FindFirstChild("Right Arm")
		if lh and rh then
			lh.LocalTransparencyModifier = 0
			rh.LocalTransparencyModifier = 0
			print("disabled transparency")
1 Like