Wondering where the PlayerSpawn function is...


I was kinda wondering where the PlayerSpawn function is, as I can’t seem to find it.

What I’m trying to do is make player(s) spawn with a custom model on a sandbox server.

(My server is a war server btw)

I was also wondering how many models to can set to spawn with, if you can.



– for an addon, you want this
– for a gamemode, you want this
function GM:PlayerSpawn(ply)

Thanks for that, Do you know where the file is?

I have updated the example.
The first one you can put anywhere, provided that the file you put it in is being ran on the server.
The second one you can put anywhere in the gamemode, provided that the file you put it in is being ran on the server.

So basically I can just do this>

lua/autorun/server(or client)/PlayerSpawn.lua

with all that inside…?

You can do lua/autorun/server/PlayerSpawn.lua with the first example inside, OR gamemodes/your_gamemode_name/gamemode/init.lua (or any other file that runs on the server) with the second example inside.

Okay thanks Co2. :D, You’ve helped a lot.