Lua Gamemode Help

Hey, Im a newbie at lua… Im trying to make a racing type gamemode. Ive made a simple menu, and I need help with the command the button on my menu does. Im trying to make it spawn a jeep or airboat. Heres the code im using, any help will be really appreciated.

JeepButton.DoClick = function() RunConsoleCommand(“gm_spawnvehicle”, “vehicle_jeep”) CarFrame:Close() end

Thanks. Please reply.

does your gamemode derive from sandbox?


Next time you should post this kind of stuff here. That aside are you getting any errors or anything? Also you may want to look into using **[Ents.Create](** for your spawning of your vehicles.

Thanks, but how exactly would I use ents.create in this code? I tried this and its giving me lua errors

Button.DoClick = function() ents.Create(“vehicle_jeep”)
ent:Spawn() WeaponFrame:Close() end

local ent = ents.Create( “prop_vehicle_jeep_old” )
ent:SetModel( “models/buggy.mdl” )
ent:SetKeyValue( “vehiclescript”, “scripts/vehicles/jeep_test.txt” )
ent:SetPos( tr.HitPos )

Also, don’t just say something’s giving you Lua errors, copy and paste them, it helps a lot :slight_smile:

And no one is going to tell him is script wont work?

Clientside and serverside, learn the difference.

I feel really thick for missing that now :suicide: