• Networked Vars not working
    4 replies, posted
Hey there, i'm struggling a bit with Networked Vars. Here's a example code I tried: Server: [lua]for k, v in pairs(player.GetAll()) do v:SetNWInt("testing", 1) end[/lua] Client (Hud): [lua]if(ply:GetNWInt("testing") == 1) then print("I'm called!") end[/lua] It's not printing the "I'm called!". But, for some reason, it is called as soon as I save a file in the Gamemode (no matter what I change or what I save). Best Regards, DasNeo.
If you only have that as your code it's not going to work
Hey, no it's not the only code. Made the server-code in a command to run it whenever I want. (which is working) And the client code is in [lua]hook.Add( "HUDPaint", "PolygonCircleTest", function()[/lua] Thanks, DasNeo.
[code]if(ply:GetNWInt("testing") == 1) then print("I'm called!") end print("Am I even called?", ply )[/code] [code] print("SERVER: Setting NWInt...") for k, v in pairs(player.GetAll()) do print("SERVER: Setting for player", v ) v:SetNWInt("testing", 1) end print("SERVER: Done!")[/code] Now post console log.
Hey, thanks for your Answer. I found my mistake. ply was in client undefined. Thought I had that done. Thanks anyways :v: DasNeo
Sorry, you need to Log In to post a reply to this thread.