Game Crashes while coding

Around 1 day ago I was making a HUD for my server in singleplayer using the DarkRP gamemode and after coding some stuff my game just crashed for no reason, no error messages, no errors in the code or at least I think there is no errors, because when I restart the game it just crashes again after some minutes. I posted here because I didn’t know if it is crashing because of the code or because when I save the code it automaticly shows on the game and when you reload it a lot of times it crashes.

If you know something that could be causing this or if you had that before just please just post in the thread cause its really annoying to reopen the game everytime.

PS: I am NOT really good with making threads.

If it only happens while in singleplayer and after you made these changes it definitely is your hud, try disabling the most recent parts you have been working on to do a bit of debugging, if you can pinpoint down to whats causing it by temp disabling parts you will be able to resolve this easily by yourself, or post the code for others to see

I will test it on my server to see if it will crash

If something you think might crash your game, my first instinct would be to try removing that thing.

Its the HUD i just tried in my server but I don’t know what is making that happen.

[editline]11th February 2016[/editline]

Can you help me out to find what the problem is because I am a new with coding so I really don’t know what to do.

Are you creating vgui panels in HUDPaint?

No I am not

EDIT: I am not going to create one yet because in the HUD i will be adding the playermodel face thing on the left top and I saw that I will need to use vgui.Create(“DModelPanel”) to add the playermodel face thingy

Might as well do the bad thing and make the whole HUD out of vgui and use think hooks within the panels to update everything.

I remember having a few crashes when using vgui’s under a paint function (misplaced).
Check if that isn’t yours

Are you creating fonts inside the paint hooks?

Could you post a bit of code you’re using for the HUD?

Yes I am


 surface.CreateFont( "FontBig", {
    font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
    size = 28,
    weight = 500,
    blursize = 0,
    scanlines = 0,
    antialias = true,
    underline = false,
    italic = false,
    strikeout = false,
    symbol = false,
    rotary = false,
    shadow = false,
    additive = false,
    outline = false,
} )

    surface.CreateFont( "FontSmall", {
    font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
    size = 22,
    weight = 500,
    blursize = 0,
    scanlines = 0,
    antialias = true,
    underline = false,
    italic = false,
    strikeout = false,
    symbol = false,
    rotary = false,
    shadow = false,
    additive = false,
    outline = false,
} ) 

EDIT: Should I create cl_font.lua to add the fonts?

Just make sure its created outside of the hook. Like right above where you define the hook

Thank you I think it helped