SendLua not registering Color() variable

Seems I’m having an issue, but I don’t have a tissue :frowning:

All jokes aside, I was making a function to change a player’s job appearance in darkrp.

This is the function that is causing the problem:

local function CoverJobInfo(Ply, Col, JobName, Model)
	for k,v in pairs(player.GetAll()) do 
		v:SendLua("team.SetColor(TEAM_UNDERCOVERPOLICE, Col")

I’ve narrowed it down to the **Col **variable. The SendLua doesn’t want to take it. Replacing the **Col **variable with “Color(50,50,50)” fixes the problem.

Calling on the function:

CoverJobInfo(ply, Color(50,50,50), "Thief", "models/player/arctic.mdl")

Any ideas?

For one, you are missing a close parenthesis in your SendLua code, but that’s not how SendLua works. It is in a unique client scope since the string is literally networked to the client with no other information. Really, you shouldn’t be using SendLua at all, just network the color to all players.

Thanks for the reply code_gs. I’m not aware of how to network the color to the other players without SendLua.
Is there any chance you’d be able to point me in the right direction?

net.WriteColor /


Excuse my ignorance but I have the function in autorun of lua/server. Would I place the util.AddNetworkString() in lua/server then create a file in server/client to receive it?

If you have the function in lua/autorun/server, add the util.AddNetworkString() there. To recieve it and use it, create another file in lua/autorun/client

Sounds like a plan. Thanks for the help!

You can also use a realm check (if SERVER then) to keep everything in one shared file