Soo.. yeah. Datastores aren't exactly my thing, so here goes:
So I want a script to save multiple tables from different sources. All these sources are inside the Player Instance.
When I leave the game it saves the first table fine, but the second one returns with this error message: "PlayerScripts is not a valid member of Player".. Which is odd because.. well.. it is.
I looked into it and apparently the player leaves the game quicker than the script can run through the table and save everything, which is a problem.
local ToolsToSave = {} for i,v in pairs(plr.Backpack:GetChildren())do table.insert(ToolsToSave, v.Name) end local ItemsToSave = {} for i,v in pairs(plr.PlayerScripts.Items:GetChildren())do table.insert(ItemsToSave, v.Name) end
This is the script ^
Correct me if I'm wrong but I think it takes too long to save before everything in the player is packed up. Any help is appreciated. Is there any way to delay the player leaving the game. Or maybe there's a more effective way to grab everything I need?
Thanks - FlabbyBoiii