Save money instantly?

Hey I’m pretty new to the community so please forgive me if I’m being a total idiot,
I’m building a multiple character script but running into a few problems.The problem I’m having is, when using the command to change character, all is fine, it goes to the char select screen etc… Made it save the user details on changing character BUT the money doesn’t save instantly. Everything else in user table saves fine, except the money. It does save to the database but I’m guessing it uses something else to trigger it? which is annoying because then people can use the system to duplicate money. Does anyone know of any reason money takes a while to save to the database and what i can do to trigger it to save on changing character?

Thanks!

Are you using any framework? or is it also written yourself?

Ah sorry forgot to mention using ESX

Guess you shouldn’t set money in the database directly as it doesn’t update instantly on the server, you might want to get the xPlayer and call setMoney(amount) and setBankBalance(amount) methods

1 Like

Hmm could have sworn I tried it, I’ll try setmoney and bank balance again later, please can you keep this topic open just in case? Thanks

1 Like

I’m still having issues with this unfortunately :confused: extremely confused. Is this only happening to me? There must be a way people save money instantly on character change. I use ESX.SavePlayers() which successfully saves everything other than money. hmm