I've tried fixing the script moving the location and nothing works.
local ServerStorage = game:GetService("ServerStorage")
local DataStore = game:GetService("DataStoreService")
local TeamDataStore = DataStore:GetDataStore("PlayerTeamSave")
local Players = game:GetService("Players")
local SessionData = {}
local Auto_Save_Interval = 10
local function saveData(player)
local playerUserId = player.UserId
local attempt = tick()
local success = nil
repeat
success = pcall(function()
TeamDataStore:SetAsync(playerUserId, SessionData[playerUserId])
end)
until success or (tick() - attempt) >= 30
if not success and (tick() - attempt) >= 30 then
warn("Cannot save data for player!")
end
warn("LOL!!!")
end
local function autoSave(player)
local playerUserId = player.UserId
local Data = TeamDataStore:GetAsync(playerUserId)
while wait(Auto_Save_Interval) do
for playerUserId, Data in pairs(SessionData) do
saveData()
end
end
end
local function setUpPlayerData(player)
local playerUserId = player.UserId
local success, yeiit = pcall(function()
return TeamDataStore:GetAsync(playerUserId)
end)
if success then
if yeiit then
SessionData[playerUserId] = yeiit
else
SessionData[playerUserId] = {Team = "peasant"}
end
else
warn("Cannot access data store for player!")
end
end
Players.PlayerAdded:Connect(setUpPlayerData)
Players.PlayerRemoving:Connect(saveData)
warn("Running!!!")

1 comment
there isn't anything in session data table so it's going to save an empty table duh