This is an over-the-shoulder thirdperson I made a while ago. It should probably help you.

```
local OldAngles = EyeAngles()
local ThirdpersonAngles = EyeAngles()
local Minimum = Vector(-5, -5, -5)
local Maximum = Vector(5, 5, 5)
local Enabled = CreateClientConVar("thirdperson_enabled", "0")
local Distance = CreateClientConVar("thirdperson_distance", "100")
local Offset = CreateClientConVar("thirdperson_offset", "20")
local Thirdperson = function(ply, origin, angles)
if !(Enabled:GetBool()) then return end
if (ply:GetMoveType() == MOVETYPE_OBSERVER) then return end
local view = {}
local trace = {}
local ShootPos = ply:GetShootPos()
angles = ThirdpersonAngles
ThirdpersonAngles = ThirdpersonAngles + (ply:EyeAngles() - OldAngles)
local trace = util.TraceHull({
start = origin,
endpos = origin - (angles:Forward() * Distance:GetInt()) + (angles:Right() * Offset:GetInt()),
mask = MASK_SOLID_BRUSHONLY,
mins = Minimum,
maxs = Maximum,
filter = {me},
})
if (Distance:GetInt() < 0) then
angles.p = -angles.p
angles.y = angles.y + 180
local ang = (trace.HitPos - ShootPos):Angle()
ply:SetEyeAngles(ang)
else
local trace2 = util.TraceLine({
start = trace.HitPos,
endpos = angles:Forward() * 0x7FFFFFFF,
mask = MASK_SHOT,
filter = {me},
})
local ang = (trace2.HitPos - ShootPos):Angle()
ply:SetEyeAngles(ang)
end
OldAngles = ply:EyeAngles()
view.origin = trace.HitPos
view.drawviewer = true
view.angles = angles
return view
end
local MoveFix = function(cmd)
if !(Enabled:GetBool()) then return end
local me = LocalPlayer()
if !(IsValid(me)) then return end
if (me:GetMoveType() == MOVETYPE_OBSERVER) then return end
vel = Vector(cmd:GetForwardMove(), cmd:GetSideMove(), 0)
vel:Rotate(me:EyeAngles() - ThirdpersonAngles)
cmd:SetForwardMove(vel.x)
cmd:SetSideMove(vel.y)
end
hook.Add("CalcView", "Thirdperson", Thirdperson)
hook.Add("CreateMove", "Thirdperson Movement Fix", MoveFix)
```