Client Side script can NEVER load fully at start up, I always have to reload it.

Why is this… My script never loads fully when I join any kind of game, single player whatever. I have to have a key binded to use lua_openscript_cl to load it…

It’s really annoying and I can’t figure out why. It’s always trying to execute some functions that involves something that isn’t loaded fully yet. I’ve looked at other scripts and they don’t have the same problems.

I’ve added tons of failsafes and checks that involve checking if the player is actually valid but nothing seems to be helping the problem. I mean I fixed some of the problems with ents being null because the game hasn’t loaded fully yet… but wtf.

None of the other scripts I see have any of these loading problems, and they don’t have any fail safes to prevent these problems either. I can’t figure out for the life of me what the problem is. I mean when I use lua_openscript_cl AFTER the game has loaded the script loads fine, and works perfect… but anything before that it can never load correctly.

I have hooks that paint on the screen, and some of them wont go until I reload the script… it takes a second but it’s very annoying… Anyone know how I can combat/fix this problem?

Put it in lua/autorun/client

-.-

It is, always has been, never has been in any other spot.

I had an issue like this once. I just played around with a timer so it would execute a tiny bit later and it worked fine. I’m not sure if that would work in your situation though. I think I only had my issue because I was overriding default sandbox settings.

I have this exact same problem and it annoys the shit out of me.

Try adding your code to the InitPostEntity hook. If it already is, or that doesn’t work, then idk, gmod is wierd some times.

I just put mine in lua/autorun. I’ve never put anything in client. It’s always worked for me.

Do what Yakahughes said. Any script that is loaded on startup and has to do with entities should be place within an InitPostEntity hook, which is called after all entities have been fully initialized.

Try actually posting the code so we can tell you what’s wrong?