Clueless as to where this code should go.

So I have this bit of code a friend/dev gave me



for k, v in pairs( ents.FindByClass( "door" ) ) do     
   v:Fire("unlock") 
end

All it does is take the doors of a map and unlock them. Useful for if you want to unlock doors for another gamemode.
The issue is I have 0 clue where the code goes and the friend is asleep but im trying to get this launched ASAP because we’re on a bit of a schedule. If anyone has any idea where the code could go please let me know.

Could just give it a go in garrysmod/lua/autorun/server.
Should work.

Nope, doesnt work.

garrysmod/lua/autorun/server/filename.lua

You have to create a new file in the server directory…

[editline]11th September 2017[/editline]

And it’s only going to be ran when it’s refreshed, it’s not hooked into anything.

It will work 100%.
It’s very rude to steal someone’s code, upload it without their permission, ask where it goes, and then even when someone tells you where it goes, just shrug it off as not working.
This forum is meant to be for developers who know what they’re doing, and are having problems with their own code.
If you really want to know ‘where it goes’, then at least learn the basics of gLua first.

And about your ‘schedule’, it seems very one-sided if you can’t even be bothered waiting for him, even though he made the code in the first place.

[editline]12th September 2017[/editline]

Sorry for being rude. I know it’s just 3 lines of code, but you could at least wait for him to come online. It’s not that hard to work out.