Viewmodel 'wall-avoidance' is awfully jittery

https://gyazo.com/e8703682880c33a4324e6e045ac81e83

i’ve created a little algorithm for making sure the viewmodel does not collide will walls and during my few testing of it making sure it works properly it’s decided to jitter ALOT when in action and i’m not too sure what to do with it.


		if vm and wep then

			local result = workspace:Raycast(vm:WaitForChild("SecondaryRootPart"):WaitForChild("startOfOBJ").WorldPosition,vm:WaitForChild("SecondaryRootPart"):WaitForChild("startOfOBJ").WorldCFrame.LookVector * wepModule.basicStats.gunLength, viewmodelParams)

			if result then


				game:GetService("TweenService"):Create(script:WaitForChild("viewmodelPushy"), TweenInfo.new(0.1,Enum.EasingStyle.Sine), {Value = CFrame.new(0,0,result.Distance)}):Play()

				aimrestriction = true

			else

				game:GetService("TweenService"):Create(script:WaitForChild("viewmodelPushy"), TweenInfo.new(0.25,Enum.EasingStyle.Sine), {Value = CFrame.new(0,0,0)}):Play()
				aimrestriction = false

			end

		end

The jitter is caused by a lot of tweens being executed at the same time. You should try Lerping the CFrame value instead