How can I make a dynamic light attatch to a prop?

Hi there.

I’m trying to make a dynamic light system that will spawn a prop and then have a dynamic light attached to it. This would be used for police lights.

Set the position of the dynamic light in think hook, or recreate the dynamic light every time.

 	local m_eLight = ents.Create("light_dynamic")
	m_entLight:SetKeyValue("_light", "255,93,0 100")
	m_entLight:SetKeyValue("brightness", "6")
	m_entLight:SetKeyValue("distance", "300")
	m_entLight:Fire("TurnOn", "", 0)

This is an extract from one of my entities which creates a fire-red light at the prop’s position and ties it to it until removal where it will be destroyed, “_light” is the colour control, you’d be using RGB for this.

There’s a Lua binding for this.