Send string from server side to client side script?

Hi,

how can I send a string from a script that is run in “lua/autorun/server” to a script that is run in “lua/autorun/client”?

For example this is in the server side script:
[LUA]local text = “Hi my name is iSt4n”[/LUA]

And this in the client side script:
[LUA]words = string.Explode( " " , text )[/LUA]

Thanks for answers!

Server



util.AddNetworkString("NetLib")

net.Start("NetLib")
net.WriteString("MyString")
net.Send(Player)


Client



net.Receive("NetLib", function()
local myString = net.ReadString()
end)


I keep getting this Error:



[ERROR] lua/autorun/server/es_server.lua:13: attempt to call field 'AddNetworkedString' (a nil value)
  1. fn - lua/autorun/server/es_server.lua:13
   2. Call - addons/ulib/lua/ulib/shared/hook.lua:183
    3. unknown - gamemodes/terrortown/gamemode/init.lua:693


I did the same thing you wrote, even looked up more about it in the wiki, but i dont know what this error means.

EDIT: Ok, got it, it’s AddNetworkString not AddnetworkedString, thanks.

Network not Networked

I’m lost without autocomplete :wink: