Scripts won't run unless i mess with them

My scripts won’t run (though they’re in autorun/client). They run only when i maybe change something, it gives an error, and then i fix it, only then it’s compiled in the game. Why?

because they have errors in?

“My shit doesn’t work until I fix it what the fuck is happening”

You got it all wrong. My scripts won’t run, I need to make any change in it for it to work. For example, i start my server, script isn’t running, but when i create an error and fix it the script runs. It’s like it doesn’t know it’s there until i make a change in it

Perhaps you could show us the code?
It sounds to me like you have some conditions that aren’t true or perhaps missing hooks.

The code works. The fact that if i delete the file and paste it again it WILL work.

I always get this for some reason. It’s why I fail at making shops. The files with the custom functions dont load and when I open the shop, I cant buy it because itll return that TakePoints is a nil function. Would like a solution too please

Working and erroring are two different things.

Load order. Use one file in autorun to load each file using include and AddCSLuaFile. Like this:



if SERVER then
	AddCSLuaFile()
	AddCSLuaFile( "sh_player_ext.lua" )
	AddCSLuaFile( "store.lua" )
	AddCSLuaFile( "weapons.lua" )
	AddCSLuaFile( "scoreboard_colors.lua" )
	AddCSLuaFile( "hooks.lua" )
	AddCSLuaFile( "perks.lua" )
	AddCSLuaFile( "vgui/menu.lua" )
	// AddCSLuaFile() other clientsides and shareds
	
	include( "store.lua" )
	include( "rewards.lua" )
	include( "sh_player_ext.lua" )
	include( "weapons.lua" )
	include( "scoreboard_colors.lua" )
	include( "hooks.lua" )
	include( "perks.lua" )
	// include() other serversides and shareds
end

if CLIENT then
	include( "store.lua" )
	include( "sh_player_ext.lua" )
	include( "weapons.lua" )
	include( "scoreboard_colors.lua" )
	include( "hooks.lua" )
	include( "perks.lua" )
	include( "vgui/menu.lua" )
	// include() other clientsides and shareds
end


The order in which you include() them matters.

Sounds like autorefresh triggers this. Try adding a timer before the function which isn’t running.

What do you mean?

This may be the same issue I was having with loading order. Handsome Matt’s suggested PostGamemodeLoaded hook. See if that will help.

Autorefreshing the lua makes the script work, so try adding a delay using timer.Simple() before the code is run.