[Help] variable problem

how to create a variable. which will stay forever in client side. and i can call it anytime in any source file even on the different lua resource

i mean if i wrtite this var in testscriptclient1.lua so i save the variable in this… but if i want to write another system in anothertestscript2.lua but i want to called the var which store in testscriptclient1.lua how can i do it… >the global var from client side

sorry for bad eng please help

Why don’t you use MySQL database ?

You can make a server event where you send the variable in and it uses a call back to send it to a new place. I would not recommend uses MySQL for this.

yes u right . becuz i already get the var from sql when player connect. and what i want is the keep the var which i get from sql server to it.

I mean i want to create a variable which keep in client side. like inventory system… but i don’t want to query the sql everytime when i wanna get data from it… so i want to keep the value in the client side first and when player quit the game or something it will saved when player quit the game… it is not good to query sql every single time right?

Just query once, stock your result and manipulate it. You can stock in client side and all 1 minut put in database, but, don’t forget to save when player disconnect too

Or just load everything on join to a usable table, manipulate that and on disconnect save all of it. That way you have fast response time and you dont have the server hang from mysql

That is optimizated, but what a bout server crash ?
Loose all data from the connection ? :confused:

I believe there are server events for that, or just the resource stopping…

Both working, @AmonRetour just script it now ! :wink:

1 Like

ty guys +++++++++++++++

can someone give an exemple righ here how to make a variable that will be attached to the player… ???

like for example a variable called exp:

i am able to understand lua scripting but not this part…