So im learning GLua and Im just doing the best way I know which is reverse engineering and Im creating a basic script that does stupid but kinda cool stuff. I dont want just a solution but why its a solution so I can understand on better improve upon myself. I want my script to give me a weapon atm. I am in single player sandbox. This is what I have so far
concommand.Add( "be_swag", function( ) print("SWAG Loading") net.SendToServer():LocalPlayer():Give("the_quickscoper2") chat.AddText(Color(0,255,255) "You're now MLG") chat.AddText(Color(0,255,255) "which is Step 1 of being swag") end) chat.AddText(Color(255,0,0), "Made Console Command") chat.AddText(Color(255,55,0), "Type be_swag to have swagger")
but I get this error after running “be_swag”
[ERROR] lua/printtest.lua:3: attempt to index a nil value 1. unknown - lua/printtest.lua:3 2. unknown - lua/includes/modules/concommand.lua:69
What is wrong with this script and how may I fix it? Am what im trying to do possible?
EDIT: and yes this a client side script located at E:\Steam\steamapps\common\GarrysMod\garrysmod\lua\printtest.lua
Workers great but seems inefficient