Having a problem with sv_loadingurl and the javascript functions

So recently I’ve been working on a loading screen and have ran into a weird error that has left me stumped. Bear with me as it is very confusing. Here is the code for the loading screen.

Note: I’ve tried other loading screens from different servers that use the javascript functions. They had the same problem which leads me to believe it is a local or server-side problem.

Here is the timeline for the bug:

**Other useful information to note with the bug: **

  • It seems that if you back out of the loading page to the Garry’s Mod main menu then attempt to rejoin the server, the code runs flawlessly.
  • I’ve ruled out local problems with my version of Garry’s Mod, I did a fresh install yesterday.
  • I’ve talked to a few other people and they said that they had seen this problem in the past back in gmod12.