how to add a data to "player" class

SERVER SIDE:
local play=FindMetaTable(“Player”)
play.abc=1

i want to send a number to client,so i write these code,i hope i can get ply.abc in client side but i fail.
i get confused . do i have to use net.send or something?
does there any chance to accomplish by my way? thank you

Well, using the net library would be the easiest way rather than trying to do metatable stuff like you’re doing - there’s a tutorial here that might help

Couldn’t you just do this?


BroadcastLua( [[abc = 1]] )

Can someone tell me why this isn’t true (Looking at the amount of disagrees I have)?

first of all, thank you for replying. here is a question,i want to create a random number in server side , and this number stand for which team should player join in. i hope it sign to player.team .and i hope both server and client side can get this number by using player.team, can it be possible? or what is usual way to decide which team ?

[editline]6th April 2016[/editline]

first of all, thank you for replying.
here is a question,i want to create a random number in server side , and this number stand for which team should player join in.
i hope it sign to player.team .
and i hope both server and client side can get this number by using player.team, can it be possible? or what is usual way to decide which team ?

Use Player:SetTeam( number ) on the server, and then Player:Team() on the client

Use network variables

Entity:SetNWInt

Entity:GetNWInt



if SERVER then
      player.GetAll()[1]:SetNWInt("abc", 1)
else
      print(player.GetAll()[1]:GetNWInt("abc", 0))
end


Clientside should print 0 if abc does not exist and 1 or whatever value abc is.

that is helpful,i really appreciate it.

[editline]6th April 2016[/editline]

your code is really helpful to me , thank you a lot