Summer 2026 Music Kit Competition is now here! - Create a summer themed electronic music kit and submit it by - Enter Now!

Scripting
Entity Methods

Entity objects are returned by entity searches, player functions, traces, events, and item-giving functions. They cannot be constructed directly.

Wrappers are stable for the lifetime of a Source entity handle. Repeating a search for the same live entity returns the same JavaScript object, so strict equality and script-defined properties remain consistent. See the Entity value class for how handles and validity work.

The methods below are available on every Entity. Players are entities too, so they also support everything on this page, plus the Player Methods.

Identity and state

Function Returns Description
entity.IsValid() boolean Whether the retained entity handle still resolves. This is the only Entity function safe to call after deletion.
entity.IsAlive() boolean Source alive state.
entity.IsWorld() boolean Whether the entity is worldspawn.
entity.IsPlayer() boolean Whether the entity is a player.
entity.GetClassName() string Source classname, or "" when unavailable.
entity.GetEntityName() string Source target name, or "" when unavailable.
entity.SetEntityName(name) undefined Sets the target name. The name is limited to 128 bytes.
entity.GetTeamNumber() number Player team index or the entity's numeric team keyvalue.

Transform

Function Returns Description
entity.GetAbsOrigin() Vector Collision origin.
entity.GetAbsAngles() QAngle Collision angles.
entity.GetAbsVelocity() Vector or undefined Parsed velocity keyvalue.
entity.GetEyePosition() Vector Source eye position.
entity.GetEyeAngles() QAngle Source eye angles.
entity.Teleport(options) undefined Teleports using any supplied combination of position, angles, and velocity. At least one must be supplied.
entity.Teleport({
	position: { x: 0, y: 0, z: 128 },
	angles: { pitch: 0, yaw: 90, roll: 0 },
	velocity: { x: 0, y: 0, z: 0 },
});

Health, ownership, and lifetime

Function Returns Description
entity.GetHealth() number Current health, falling back to 0.
entity.SetHealth(health) undefined Sets integer health.
entity.GetMaxHealth() number Maximum health.
entity.SetMaxHealth(health) undefined Sets integer maximum health.
entity.SetOwner(owner) undefined Sets an Entity owner. Pass undefined or null to clear it.
entity.SetParent(parent) undefined Sets an Entity parent. Pass undefined or null to clear it.
entity.Kill() undefined Kills a player through Garry's Mod, or fires the Source Kill input for another entity. Worldspawn is rejected.
entity.Remove() undefined Removes the entity immediately. Players and worldspawn are rejected.

Model and appearance

Function Returns Description
entity.GetModelName() string Current model path, or "".
entity.SetModel(modelName) undefined Precaches and applies a model path of at most 260 bytes.
entity.GetModelScale() number Current native model scale. The entity must be an animating entity.
entity.SetModelScale(scale) undefined Applies a native model scale greater than 0 and no greater than 100. The entity must be an animating entity.
entity.GetColor() Color Current render color and alpha.
entity.SetColor(color) undefined Sets render color and alpha.
entity.Glow(color?) undefined Enables the entity's glow effect. The color defaults to opaque white.
entity.Unglow() undefined Disables the entity's glow effect.
entity.IsGlowing() boolean Whether glow is currently enabled for the entity.
const objective = Instance.FindEntityByName("mission_objective");

objective?.Glow({ r: 255, g: 180, b: 0, a: 255 });

if (objective?.IsGlowing()) {
	Instance.Msg("Objective glow enabled");
}

Glow state is networked and persists across script reloads. It is cleared by Unglow() or when the entity is removed. Rendering is supplied by the server's client halo integration.

Point templates

Import PointTemplate to identify map-authored Source point_template entities and spawn their configured templates:

import { Instance, PointTemplate } from "lambda_script/point_script";

const spawner = Instance.FindEntityByName("chess.template.pawn.white");
if (spawner instanceof PointTemplate) {
	const spawned = spawner.ForceSpawn();
	const piece = spawned?.[0];
}

ForceSpawn() invokes the native Source ForceSpawn input synchronously and returns the entities created during that input. It returns undefined if the input is rejected, and may return an empty array when the template creates no detectable entity. For predictable spawned[0] behavior, configure the Hammer point_template with one template entity. The referenced template entities must exist and be valid when Source builds the template during map initialization.

Project-specific extensions

A server or gamemode may add extra methods to Entity or player values beyond those documented here. These behave like ordinary entity methods but are server-specific; see project-specific extensions.