I need some help. When I try to save data, the code after the save line doesn't work. I need some help, does anyone know why this doesn't work? The data doesn't save and the code stops.
game.Players.PlayerRemoving:Connect(function(player)
print("a player left")
local teamName = player.Team.Name
local success, error = pcall(function()
myDataStore:SetAsync(player.UserId.."-team",teamName)
end)
if success then
print("success")
else
warn(error)
end
end)

1 comment
Did you define myDataStore?