Problem whit aimbot script
so i have tried making an aimbot whit toggle in lua for gmod but the script gives an error:
[ERROR] lua/ls.lua:16: 'end' expected (to close 'function' at line 1) near '<eof>'
1. unknown - lua/ls.lua:0
script
function aimbot()
CreateClientConVar( "aa_enabled", 0, true, false )
if ConVarExists( "aa_enabled" ) and GetConVar("aa_enabled"):GetInt() == 1 then
local ply = LocalPlayer()
local trace = util.GetPlayerTrace( ply )
local traceRes = util.TraceLine( trace )
if traceRes.HitNonWorld then
local target = traceRes.Entity
if target:IsPlayer() then
local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
local targetheadpos,targetheadang = target:GetBonePosition(targethead)
ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
end
end
end
hook.Add("Think","aimbot",aimbot)
Thanks in advance

(the Part of the text taht is bold is creating the errors i suppose?)