Hello, I am trying to make some code that saves some data from instances inside of a player instance. Unfortunately I am having some problems because the data only saves some of the time, I have done extensive testing at this point, and I have come to the conclusion that the instances in player are getting deleted before I can grab the data, is this the case? All the code happens within 10 or so lines, and I was under the impression that the player instance takes a few moments before getting deleted with player.removing. Any help would be appreciated
Maybe add this to the end of your datastore script so that the server has time to save.
game:BindToClose(function()
task.wait(5)
end)
I have seen many people save data inside of the player instance, so I don’t think that it is the reason why your data isn’t saving.
Yeah I’m not sure, and I’m not quite sure why it’s doing it because when testing it both by leaving the game and stopping the playtest, separately and combined it works around 50% of the time. I’m sure there’s a simple answer for it. I will try to do some debugging
This probably isn’t related to your issue since your game saves 50% of the time, but many people can’t save data inside the Studio version of Roblox. Test your game in the normal version of Roblox if you haven’t already.
I tested it in a normal roblox game and have came to the conclusion that the problem was indeed studio. I tested it 10 times straight and it worked everytime, although I am very confused what was happening in studio, it truly was working 50% of the time almost to a dime. Anyone have any ideas?
Maybe you could try to save the data multiple times in Studio with RunService
. Other than that, I have no idea.
also you responded almost exactly when i was going to close the tab for this post lol
Edit: Do you have TeamCreate enabled? I wonder if it has something to do with not using the “server” version of Studio.
No, I do not have team create enabled. This is a valid point, although that wouldn’t explain why it does work some of the time.