Can't get my entity function to work.

I’m trying to run a trace from the player to 600 units above him and then detect if a func_wall entity is above him. If the Trace finds a func_wall it should change its opacity to 170. I can’t find out whats wrong with the function, do I need to define func_wall as an entity in an entity init.lua or is there something wrong with my trace? Please halp. I’m running this in cl_init.lua because I only need it to make the func_wall transparent for the client.

function RoofTrace( ply )

	local plypos = ply:GetPos()
	local tracedata = {}
	tracedata.startpos = plypos
	tracedata.endpos = plypos+Vector(0,0,600)
	tracedata.filter = ply
	local brushtrace = util.TraceLine(tracedata)
		if brushtrace.HitNonWorld then
		local hitent = brushtrace.Entity
			hitent:SetKeyValue( "rendermode", RENDERMODE_TRANSTEXTURE )
			hitent:SetKeyValue( "renderamt", "170" )


There’s the problem, you can’t set keyvalues from client scripts, at least I don’t think so anyway. The code seems fine to me otherwise.

Hmm, it says SetKeyValue is a shared function.

So is Entity.SetPos, doesn’t mean you can teleport props around as you like from a clientside script.