Camera-Tool Rotation Causes Unintended Movement

I have a system that moves the tool relative to the camera’s movement when in first person so that if I am shooting a gun and look upwards, the gun points upwards. Everything works fine except the player’s character seems to move around like crazy even though I am only aiming around the weapon and not touching WASD.

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Waist  = Character:WaitForChild("UpperTorso"):WaitForChild("Waist")
local Camera = workspace.CurrentCamera
local Head = Character:WaitForChild("Head")

local P = Instance.new("Part", workspace)
P.CanCollide = false
P.CanQuery = false
P.CanTouch = false
P.Anchored = true
P.Transparency = 1

RunService.RenderStepped:Connect(function()
	P.CFrame = Camera.CFrame * CFrame.new(script.CFX.Value, script.CFY.Value, script.CFZ.Value)
	
	if Head.LocalTransparencyModifier >= 0.8 then
		Waist.Part0 = P
	else
		Waist.Part0 = Character.LowerTorso
	end
end)

That bouncing at the end of the video was not me hitting the spacebar