I wrote a Datastore script like a month ago, and it was working back then, but now its not working. Please help me, thanks. Script:
local DataStoreService = game:GetService("DataStoreService") local myDataStore = DataStoreService:GetDataStore("myDataStore") game.Players.PlayerAdded:Connect(function(player) local DATAS = Instance.new("Folder") DATAS.Name = "leaderstats" DATAS.Parent = player local Level = Instance.new("IntValue") Level.Name = "level" Level.Parent = DATAS local currexp = Instance.new("IntValue") currexp.Name = "currentexp" currexp.Parent = DATAS local exptolvlup = Instance.new("IntValue") exptolvlup.Name = "exptolevelup" exptolvlup.Parent = DATAS local Beri = Instance.new("IntValue") Beri.Name = "Beri" Beri.Parent = DATAS local playerUserId = "player_"..player.UserId --Adat betöltése local data local success, errormessage = pcall(function() data = myDataStore:GetAsync(playerUserId) end) if success then if data then Beri.Value = data.Beri exptolvlup.Value = data.exptolvlup currexp.Value = data.currexp Level.Value = data.Value end end end) game.Players.PlayerRemoving:Connect(function(player) local playerUserId = "player"..player.UserId local data = { Beri = player.leaderstats.Beri.Value; Level = player.leaderstats.level.Value; currexp = player.leaderstats.currentexp.Value; exptolvlup = player.leaderstats.exptolevelup.Value } local success, errormessage = pcall(function() myDataStore:SetAsync(playerUserId, data) end) if success then print("Data successfully saved!") else print("Error!") warn(errormessage) end end)
cant save dictionary: {h="hamburger",c="cambridge"} datastore can save table{"hamburger","cambridge"}