i finally achieved the effect i wanted for my framework with the viewmodel avoiding walls, but its acting really jittery
‘startOfOBJ’ is an attachment placed in the hrp positioned right by the weapons barrel
if vm and wep then
local result = workspace:Raycast(vm:WaitForChild("HumanoidRootPart"):WaitForChild("startOfOBJ").WorldPosition,vm:WaitForChild("HumanoidRootPart"):WaitForChild("startOfOBJ").WorldCFrame.LookVector * wepModule.basicStats.gunLength, viewmodelParams)
if result then
lerp(script:WaitForChild("viewmodelPushy"), CFrame.new(0,0,result.Distance),.25)
aimrestriction = true
else
lerp(script:WaitForChild("viewmodelPushy"), CFrame.new(0,0,0), .25)
aimrestriction = false
end
end