Console Spam and crashing

Ok so I have no clue what happened but a couple days ago, I started to randomly crash when I joined a game. I would just get a HL2.exe is not responding error. Today I checked my console to see why I would lag so bad and crash.

When I looked I saw that this command or message was being spammed constantly.

Lua: vgui/ViewAll.lua:340: attempt to index global ‘ents’ (a nil value)

The console just gets blown up with this message, sometimes I can actually play the game. Most times it just lags like hell or just crashes right when I connect.

Is there something I can download to fix this? Please help.

Post your specs

Not relevant - it’s a core Lua file that’s fucking up.

Verify files.