Send some variables by server to client side

Hello.
Excuse me for any grammatical errors.

I have a function in server-side and I want to put a notification, but I can put the notification only in client side, so I have to send some variable by the function in the server-side to the client-side:

Example:
(Server)



hook.Add("AServerSideHook", "example", function() --I can use this hook only serverside
local number = 10
if ply:Alive then
   number = number + 20
else
   number = number - 5
end
end


Now I want to use the code “notification.AddLegacy” to warn the player that his number is 30 or 5 but notification.AddLegacy works only client-side



function notification()
notification.AddLegacy( "Hey your number value is "..number.." !", NOTIFY_UNDO, 4 )
end


I think that I have to use something like net.write, but I don’t know how to use it.
Someone can help me?
Thank you!

Basically, you need to use the net library.
First you need to use util.AddNetworkString. Then use net.Start, net.WriteInt, and net.Send.

On the client side, use net.Receive to and net.ReadInt to receive the variable

Thank you!