#question
100 messages · Page 1 of 1 (latest)
Like imagine pet sim x, there must be hundreds of prevented datalosses
Ahh so like it crashes while updating?
Not really
How are you saving data? A dictionary or a specific data key for each player value
But like imagine if a player joins the game and all their datas lost imagine how devastating that would be 💀
See that doesn't happen though
A specific data key using tables
It will just revert back to the last save
Wait dead ah?
You would need to write a small function for that to make sure it does it every time( doesn't just load blank data) but yeah
Like beeswarm, their games kinda unclean yet their data saves so well
How can I do this?
Wait so you're saving every single value every time just one of them changes?
Yeah but that will cause a huge saving load if you have a lot of values to save
Like there's tables in each key
{Coins = 1, Pet= false}
Which could lead to datastore overloads, which causes data loss
So how should I do it if I'm saving pets
Like one time purchase pets, so true if they own it and false if they dont
There's some options but I would just save data for every player every 5 minutes or so
What if I I use the table?
💀
Just save the table
Ok but like adding more pets will make the datastores overload one day
But instead of doing it every time one value changes, just cycle save jt
It shouldn't
How to cycle save?
while task.wait(5) do
What I was saying is that if you have a lot of different values that change a lot, that could cause an overload. Like coins changing rapidly while xp also changes while pets are being saved while the players state is saved
So u saving every 5 seconds?
Ohhh, the pets and stats are on two different datastores
And so when I buy a pet, it saves all my pets and saves all the numb and string values in the other datastore
Bad or good?
Bad
Don't have two different datastores
Unless you REALLY REALLY have to because of data overload, don't
^
When I buy a pet, I update the number of coins and the pet at the same time, which will overload the key
I got an idea, what if I update two different keys, one storing the pets and one storing all the other things
No it wont
Overload occurs when you're trying to save too much data in very little time
so my setup works such that
IF any of these values update it will update the entire key
and the issue, lets say u buy a pet, ur overloading the key as ur tryna update it two spontaneous times when two things are updating

For example,
while task.wait(.1) do -- will overload
--savd data
end
function SaveGame()
local savetable = {}
for i,v in game:Getdescendants do
table.Insert(savetable, v.BrickColof)
end
-- save table
end
The second function won't overload even though it's saving a shit ton of data
Unless you save it very frequently
well i can agree, except if i update the bits and the pets too fast (which happens when i buy pets) it will overload
cause im tryna save it to the same key
Cycle save
yes i did try this and it did overload; not cycle saving
which is task.wait 5?
in simple terms um whats that?
Whatever time you want
Just save the data in cycles of every x seconds it's more efficient and has a way lower chance to overload
well except lets say they buy a pet right? then i update their bits, then it waits 5 to update, but if they leave in those 5 seconds then they lose bits but they dont get the pet
or if they buy a pet, then i get it, but the bits dont mark as disappeared till 5 secs later
Still update on player leave :)
except that doesnt work its broken half the time
No it's not
bind to close? i literally swear
k but then i need to get the player who left
I forget the name for that
Players.PlayerRemoving?
yes
OHHH
i put that in the bind to close?
or outside?
💀
game.Players.PlayeeRemoving:Connect(function(playerwholeft)
Outside
tysm
alr ima use run service to only make this work in studio should i?
i use both bindtoclose and playerremoving
thanks i fixed it, i made it so that theres no dataloss
(i didnt help at all)
nah its fine, u kinda did
Yeah
in a game i mod there is a shit ton of data loss but it only happens to one value and it changes sometimes when the game updates 💀
like in 1 update coins has the problem but another update time has the problem
idk just wanted to say that
Ok so what if a player joins and their datas been fucked?
then they have to ask the 1 active admin to restore it
and they both have to be in the same server
lmfao
💀
I feel horrible
