Making my First Code (Scoreboard)

Hello! I am Rogue Elementz!

Alright, so I’m gonna do my best to make my own Scoreboard for DarkRP in Garry’s Mod. I think I know where to start it and I’m thinking about spending a nice month on working on this. I’m a beginner when it comes to lua coding, but it’s my dream to learn something that has to do with coding–and since I own a Gmod server, I was thinking “Why not a Scoreboard?” I looked up some videos, tutorials, went on the Gmod lua coding tutorial website and learned a few things. So what I’m looking for is a few tips. And the first question I should ask is where the hell do I put my “test.lua” code so I can edit real-time in Garry’s Mod? I don’t wanna test it in my server, so I was thinking single player where f4 shouldn’t exist as a menu yet. I’d be very grateful for some help!

The file should go in lua/autorun/client or addons/youraddonname/lua/autorun/client.

something/something/lua + lua_openscript_cl
or if you dont want to navigate there just get something off mpgh that loads lua from anywhere
or just make a local server and put darkrp on

But if I put it in the Addons part, do I have to change the file into a GMA file? Or are you talking about doing it within my server?

You do not have to convert it to a gma.

Make a folder in your addons folder (make sure its all lowercase) and make folder directory to /lua/autorun/client/ inside of the folder you made. This will autorun when you launch up single player (as long as you don’t have any script errors.)

You would put your test.lua in there so it would look like
/garrysmod/addons/myfirstscoreboard/lua/autorun/client/test.lua

Awesome, that made it a heck of a lot easier. So now I’m gonna go ahead and make a small basis of my Scoreboard and test to see if it works. If you have any other tips on where I can get more information on how to make a Scoreboard or knowledge that you have about it, that’d be greatly appreciated as well.

[editline]10th October 2016[/editline]

Now I’m having a tough time on create a basic scoreboard. I’ve tried multiple different bases, even Garry’s base code, but for some reason it keeps saying “attempt to index global ‘GM’ (a nil value)” Like I’m completely new to this whole thing and I know I’m not supposed to jump right in, but I’me xpecting to spend a lot of time on this Scoreboard thing, so how can I start it?

Alright so GM functions are gamemode functions

If you want to work with them you need to join the function that already exists.

What you need is a hook