I was creating a dataStore script and suddenly when I tested the game on server mode, the game crashes after about 5-10 seconds. I can't use the devConsole because the serverSide cleared. Here's the datastore code.
--SAVE function Enter(plr) plr:WaitForDataReady() local DS = game:GetService("DataStoreService"):GetDataStore("STATS") local l=DS:GetDataStore(plr.UserId.."_GEMS") plr.leaderstats.Gems.Value=l plr.leaderstats["Blue Coins"].Value=DS:GetAsync(plr.userId.."_BCOINS") ge=plr.Gems:GetChildren() for i=1,#ge do ge[i].Value=DS:GetAsync(plr.userId.."_GEM_"..i) end bc=plr.BCoins:GetChildren() for i=1,#bc do bc[i].Value=DS:GetAsync(plr.userId.."_BC_"..i) end end function Exit(oplr) local DS = game:GetService("DataStoreService"):GetDataStore("STATS") ge=oplr.Gems:GetChildren() DS:SetAsync(oplr.userId.."_GEMS",oplr.leaderstats.Gems.Value) DS:SetAsync(oplr.userId.."_BCOINS",oplr.leaderstats["Blue Coins"].Value) for i=1,#ge do DS:SetAsync(oplr.userId.."_GEM_"..i,oplr.Gems.i.Value) end bc=oplr.BCoins:GetChildren() for i=1,#bc do DS:SetAsync(oplr.userId.."_BC_"..i,oplr.BCoins.i.Value) end end game.Players.PlayerAdded:connect(Enter) game.Players.PlayerRemoving:connect(Exit)
Now, could this have anything to do with the number of asyncs created? I will peovide any more scripts if needed.
Here's the game link.
http://www.roblox.com/games/292183989/Pencils-Place-Number-86
All thanks in advance!