Garry's Mod Wiki

Entity:Spawn

  Entity:Spawn()

Description

Initializes the entity and starts its networking. If called on a player, it will respawn them.

This calls ENTITY:Initialize on Lua-defined entities.

Example

Server sided script for spawning entities

local ent = ents.Create("Enter Entity Class") -- Sets the position of the entity ent:SetPos(Vector(0.0, 100, 0.0)) -- Sets the angle of the entity ent:SetAngles(Angle(0.0, 90.0, 0.0)) -- Spawns the entity on all clients ent:Spawn()
Output: Spawns entity on position(0.0, 100.0, 0.0) facing (0.0, 90.0, 0.0) for all clients connects to the server