DynamicLight()

I can’t seem to get it to work. Any help?

[lua]
local dlight = DynamicLight( self:EntIndex() )

if ( dlight ) then
local r, g, b, a = Color(255, 175, 0,100)
dlight.Pos = self:GetPos()
dlight.r = r
dlight.g = g
dlight.b = b
dlight.Brightness = 2
dlight.Decay = 1024 * 5
dlight.Size = 1024
dlight.DieTime = CurTime() + 1
end
[/lua]

(I just copied it from the gmod light entity)

Where are you running the code?

ENT:Think() on client, same as the gmod light entity