Update DMixer Color every second?

So ive made a little addon that allows the players to change the color of a panel, i need to know how i would make it update every time the button is clicked. Basically how the whole code is done is theres a button that gets the color of a color mixer and sends it to the server where it is set to a networked variable, then the actual color of the panel thats customizable gets that networked variable. Not the best way to do it but it works. So now when i click the button to send the color, it only will update if the map switches.

Ive tried using a think hook, but that didnt work. I also tried a timer that would check ever 5 seconds, that also didnt work.
Can someone help me out with this?

Post code

Server Code:


util.AddNetworkString( "hudmixclr" )
net.Receive( "hudmixclr", function( len, ply )
   local tbl = net.ReadTable()
   vector = Vector(tbl.r, tbl.g, tbl.b)
   ply:SetNetworkedVar( "hudclr", vector )       
   --print(tbl)
   --print(vector)
end) 


Hud code:


local hudclr = LocalPlayer():GetNetworkedVar("hudclr", Color(20, 20, 20, 245))

Button code:


confirmbtn.DoClick = function()
      local vector = hudclr:GetColor()
      net.Start("hudmixclr")
      net.WriteTable( vector )
      net.SendToServer()
      print(vector)
    end

Send another net message after the server has changed the networked var to notify clients of the update

Everythings done client sided. The only use of server code is to set the networked var, so i dont see how that would work

I gave you an answer that works.
Send another net message that clients will receive and will then update the color variable.

The issue with the color picker, if you’re using the swatches, is that it’s delayed. It handles the click and then changes color, so it’ll be delayed.

Wrap the net-code inside a timer.Simple 0 to send it one frame after the click.

As for networking, save the color in some variable on the server; network it to clients when they join or when it changes. Should be straighforward.

-snip im stupid :smiley: