Garry's Mod Wiki


GM:PlayerSpawn( Player player, boolean transition )


Called whenever a player spawns, including respawns.

See GM:PlayerInitialSpawn for a hook called only the first time a player spawns.

See the player_spawn gameevent for a shared version of this hook.

By default, in "base" derived gamemodes, this hook will also call GM:PlayerLoadout and GM:PlayerSetModel, which may override your Entity:SetModel and Player:Give calls. Consider using the other hooks or a 0-second timer.


1 Player player
The player who spawned.
2 boolean transition
If true, the player just spawned from a map transition. You probably want to not touch player's weapons if this is set to true from this hook.


Prints a message when a player spawns.

function GM:PlayerSpawn( ply ) MsgN( ply:Nick() .. " has spawned!" ) end
Output: Player1 has spawned!


Prints a message when a player spawns using a hook.

local function Spawn( ply ) print( ply:Nick().. " has spawned!") end hook.Add( "PlayerSpawn", "some_unique_name", Spawn )
Output: Player1 has spawned!

Page Links

Special Pages



Render Time: 83ms

DB GetPage 52
Generate Html 11
SaveChanges (1) 9
Render Body 0
Render Sidebar 9