Help using data saving system (file.read/file.write)

Hello, I am new to lua and I would appreciate if someone would take the time to explain to me a basic saving system using file.Read/file.Write. I have checked many scripts using this system but they are way too complex for me to really learn from them. Also if you could make me a really simple example such as saving a random number for every player that joins, I would appreciate that as well. But if you think that wont help me feel free to link me to helpful resources.

I don’t believe I am asking too much but if you feel as if this post is stupid and pointless then please don’t waste your time and leave a hateful comment/rate.

Save: table -> JSON -> file
Load: file (JSON) -> table

If you need a random number for every player that joins, you could just do



hook.Add( 'PlayerSpawn', 'AssignNumber', function(ply)
ply.RandomNumber = math.random(1,9999) --Change this to your own upper and lower limits
end)

print(LocalPlayer().RandomNumber) > Some number between 1 and 9999


You don’t necessarily have to use file.Read and Write for data like that (unless you want to).

Also,

file.Read and

file.Write are explained pretty well in the links right there.

I’d suggest learning to do mysqloo stuff instead. It’s much more effecient and a better use of time.