Wait command in .cfg script

I was making a rather basic .cfg script and I need the script to wait about 5 minutes before performing an action. When executing the script it doesn’t know the wait command. How can I use the wait command or what is a suitable alternative?

There’s no ‘wait’ command since some source engine update.

You’re in Gmod. Write a Lua script.

I dont know enough lua to write even basic stuff and if someone could it for me I’d be grateful

Do it yourself. http://www.lua.org/docs.html, http://wiki.garrysmod.com

Yes that is extraordinarily helpful

Sarcasm doesn’t get you anywhere. If you can only do what you want to do in Lua, and you don’t know how to code Lua, so people give you links to help you, The leeast you can do is be greatful.

And just to point you in the right direction, you either want to be using Timers with delays, or loops.

That tutorial showed me how to make a SWEP from a template and nothing in the general direction of scripting

So you’re telling me that on the front page of the wiki is a tutorial? I don’t think so. What you will do is search up the Timer library, and see how it works. Then you’re going to create a lua script in “garrysmod/lua/autorun” ( Create the directory if it doesn’t exist ), and place the following ( I’m not the type of guy that feeds code to people like you, so you’re going to need to fill in the blanks ).


local MyDelay = 1 – In seconds, you can use decimal numbers, but you can’t do stuff faster than ticks.

timer.Simple( MyDelay , function( ) – Call timer.Simple with 2 arguments, the Delay, and the function its going to call

-- Do what you want in here.
print( "Youpi!!!")

-- you can do this as many times as you want, ex:

timer.Simple( MyDelay , function( )

	-- This gets gets called 1 second after "Youpi" is in the console
	-- So 2 seconds after the start of the script in total.
	-- Just shove timers inside each other
	-- ( Use Timer.Create if you want to do something more complexe )

	print( "Yes")


end) – End defining function, close function braket.

– Another example :

local function MyFunc( )

print( "Youpi!!") 
timer.Smple( MyDelay , MyFunc )


timer.Smple( MyDelay , MyFunc )

– Makes a repeating function, same as doing this:

local function MyFunc( )

print( "Youpi!!") 


timer.Create( “Id” , 1 , 0 , MyFunc ) – 1 second delay, 0 repetitions ( 0 is infinit in this case )