A few major Problems with lua codes (player models not working mainly) Please help :)

So i have a few problems and ive tried problem solving on my own but to no success:

  1. Player models just refuse to work.
  2. Ive tried to make it so a players name appears over a players head and the color changes depending on team but it does not work
  3. Trying to make it so team3 can no-clip but only team three
  4. trying to find how to make a team kill counter (counts kills of whole team rather than the individual)
    If anyone can help id appreciate it so much

Init.lua


AddCSLuaFile( "cl_init.lua" ) 
 AddCSLuaFile( "shared.lua" ) 
 
 include( 'shared.lua' ) 

 function GM:PlayerInitialSpawn( ply )
 
     ply:ConCommand( "team_menu" ) 
	 ply:SetTeam( 3 )
 end
 
 function GM:PlayerLoadout(ply)

	ply:StripWeapons()
 
	if ply:Team() == 1 then 
		ply:Give("weapon_crowbar") 
		util.PrecacheModel( "models/Player/bloodz/slow_3.mdl" )
		ply:SetModel( "models/Player/bloodz/slow_3.mdl" )
  
end
 
	if ply:Team() == 1 then 
		ply:Give("weapon_crowbar")
		util.PrecacheModel( "models/Player/cripz/slow_3.mdl" )
		ply:SetModel( "models/Player/cripz/slow_3.mdl" )
	
	elseif ply:Team() == 3 then 
		ply:Give("weapon_bugbait") 
 
	end
 
end
 
 function team_1( ply ) 
 
     ply:SetTeam( 1 )
	 ply:Spawn()
 end 
 
 function team_2( ply ) 
 
     ply:SetTeam( 2 ) 
	 ply:Spawn()
 end 
 function team_3( ply ) 
 
     ply:SetTeam( 3 )
	 ply:Spawn()
 end 
function GM:PlayerShouldTakeDamage( ply, victim )
	if ply:IsPlayer() then
		if ply:Team() == victim:Team() then
			return false
		end
	end
	return true
end
 
 concommand.Add( "team_1", team_1 )
 concommand.Add( "team_2", team_2 )
 concommand.Add( "team_3", team_3 ) 
      

Cl_init.lua


 
include( "shared.lua" )

function set_team()
 
 frame = vgui.Create( "DFrame" ) 
 frame:SetPos( 100, ScrH() / 2 ) 
 frame:SetSize( 200, 200 ) 
 frame:SetTitle( "Change Team" ) 
 frame:SetVisible( true ) 
 frame:Center( true )
 frame:SetDraggable( false ) 
 frame:ShowCloseButton( true ) 
 frame:MakePopup() 
 
concommand.Add("-our_concommand",frame_close)
concommand.Add("+our_concommand",frame_open)
hook.Add("Initialize","frame_create",frame_create)
 
 team_1 = vgui.Create( "DButton", frame ) 
 team_1:SetPos( 50, 40 )
 team_1:SetSize( 100, 50 ) 
 team_1:SetText( "Team 1" ) 
 team_1.DoClick = function() 
     RunConsoleCommand( "team_1" ) 
	 frame:Close( )
 end 
 
 team_2 = vgui.Create( "DButton", frame ) 
 team_2:SetPos( 50, 90 ) 
 team_2:SetSize( 100, 50 ) 
 team_2:SetText( "Team 2" ) 
 team_2.DoClick = function()
     RunConsoleCommand( "team_2" ) 
	 frame:Close( )
 end 
 team_3 = vgui.Create( "DButton", frame ) 
 team_3:SetPos( 50, 140 ) 
 team_3:SetSize( 100, 50 ) 
 team_3:SetText( "Spectators" ) 
 team_3.DoClick = function() 
     RunConsoleCommand( "team_3" ) 
	 frame:Close( )
 end 
 
 end 
 concommand.Add( "team_menu", set_team ) 

  function GM:PostDrawViewModel( vm, ply, weapon )

	if ( weapon.UseHands || !weapon:IsScripted() ) then

		local hands = LocalPlayer():GetHands()
		if ( IsValid( hands ) ) then hands:DrawModel() end

	end

end
 function GM:PlayerNoClip(ply)
	return ply:IsTeam_3()
end
hook.Add( "Think", "MenuKeyListener", function()
    if ( input.IsKeyDown( KEY_F4 ) ) then
        set_team()
    end
end )
function HoveringNames()

 for _, target in pairs(player.GetAll()) do
  if target:Alive() and target != LocalPlayer() then
   elseif player == Team_1 then 
    local targetPos = target:GetPos() + Vector(0,0,84)
    local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
    local targetScreenpos = targetPos:ToScreen()
    draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(0,0,225,200), TEXT_ALIGN_CENTER)
   elseif player == Team_2 then
    local targetPos = target:GetPos() + Vector(0,0,84)
    local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
    local targetScreenpos = targetPos:ToScreen()
    draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(225,0,0,200), TEXT_ALIGN_CENTER)
  end
 end
end
hook.Add("HUDPaint", "HoveringNames", HoveringNames)


It should be if player == Team_1
What you’re doing is creating a if else if block that never gets to the team checking part.

So i think i did what you said, and there is no errors however there isnt any names now.


function HoveringNames()
for _, target in pairs(player.GetAll()) do
		if target:Alive() and target != LocalPlayer() then
			if player == Team_1 then 
			local targetPos = target:GetPos() + Vector(0,0,84)
			local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
			local targetScreenpos = targetPos:ToScreen()
			draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(200,25,25,200), TEXT_ALIGN_CENTER)
end
			if player == Team_2 then 
			local targetPos = target:GetPos() + Vector(0,0,84)
			local targetDistance = math.floor((LocalPlayer():GetPos():Distance( targetPos ))/40)
			local targetScreenpos = targetPos:ToScreen()
			draw.SimpleText(target:Nick(), "Trebuchet18", tonumber(targetScreenpos.x), tonumber(targetScreenpos.y), Color(0,0,0,0), TEXT_ALIGN_CENTER)
			
		end
	end
end
hook.Add("HUDPaint", "HoveringNames", HoveringNames)
end