Networked string, just doesn't work

All other variables work fine, even other Networked strings, though when I do this:
[lua]local class = “String”;
player[“SetNetworked”…class](player.GetByID(1), “sh_Title”, “TESSST”);[/lua]

It just doesn’t arrive at the client. Is there anything you guys can think of that might be breaking networked variables?

There are NO errors at all…

Replace ‘player[’ with ‘_R.Player[’

[editline]2nd November 2010[/editline]

And it should error since the player table doesn’t have any member named GetNetWorkedString.

What do you mean? Isn’t player a child of Entity? Entity has both GetNetworkedString and SetNetworkedString? :confused:

Anyways, I’ll try what you said later…

I think player is a known player rather than the player metatable.

You could try something like

[lua]
local class = “String”
local setnw = player[“SetNetworked”…class]
setnw(player.GetByID(1), “sh_Title”, “TESSST”)
[/lua]

Well, he’s using player.GetByID(1) so I doubt it’s a known player.
And player is a normal table, not the player meta table (which is _R.Player)

Yeah, I just realised I explained it all wrong.

This is what is actually happening:
[lua]-- Function with variable ply and class
ply[“SetNetworked”…class](ply, “sh_Title”, “TESSST”);
– End of function[/lua]

I know this way of setting a networked string HAS to work and I tried to do this on the server:
[lua]lua_run player.GetByID(1):SetNetworkedString(“sh_Title”, “TESSST”)[/lua]

When I printed LocalPlayer():GetNetworkString(“sh_Title”) on the client it didn’t print anything(It most likely printed “”, which you can not see as it is just… “”)

Sorry if I’m asking dumb questions, but did you close the menu and then reopen it between running the server-side code and the client-side code in the console?
Iirc the game needs to tick once to send networking stuff.

Hmm, let me test everything again without getting into/out of the menu or tabbing out/etc…

[editline]hmm[/editline]
Nope, it’s not sending any strings anymore D:

Maybe player.GetByID(1) doesn’t exist, and thats why it doesn’t get to the client?

actually nvm cause that would error but just posting an idea

Quite strange. Does it print the nw string correctly from the server?

Incorrect, I use NW Ints and strings on my admin mod and gamemode on players.

player is a table, not a player object.

Oh yeah, didn’t notice that, since I haven’t been working on player object before. Well, rate me dumb. D:

I think he meant the player metatable - the definition for the networked var functions are probably in the entity metatable rather than the player metatable.

Yes, if I set a NW string on the server, I can still get it on the server using GetNetworkedString… Though on the client it remains an empty string “”