My Data Store completely broke after implementing Http Service

So my game was working fine, including all saving and loading of data into a Data Store, until the exact moment I had a successful POST from HttpService to my website’s database. Since then, my data modules are loading the player data from the Data store, but the data is always completely nil. My code initializes with default data like it’s supposed to, and then when the player leaves data is saved back to the Data Store. There are NO errors with either read or write operations, but even after the data is saved back the next time I load it in the data is nil again.

I have tried printing the data out immediately after it is loaded: nil, again after initializing it: correct values, before and after saving back to the data store: correct values. I even changed the name of the Data Store to try a completely fresh one with no difference.

I don’t know how HttpService could really be interfering with it, but it would be a really huge coincidence otherwise and I have no other explanation. Here is my code for loading from data store (as bits taken from the entire module):

local DataStoreService = game:GetService("DataStoreService")
local PlayerData = DataStoreService:GetDataStore("PlayerStats")
local data = {}
local count = 0
while not success and count < 4 do
	count += 1
	success, err = pcall(function()
		print("Fetching data for "..newPlayer.userId)
		data = PlayerData:GetAsync(newPlayer.userId)
	if not success then
		warn(err..": DataStore load failed. Retrying in 5.")

Again, this code does not error.

local staleData = false
if data then
	if data["lastLogin"] then
		print("Last login on "..getDate(DateTime.fromUnixTimestamp(data["lastLogin"])))
		if data["lastLogin"] < resetTime then
			print("Old data detected, resetting data...")
			staleData = true
		print("Last login not found!")
		data["lastLogin"] =
	print("First login detected!")
if not data or staleData or dataReset then
	print("No player data found, creating new data...")
	data = {
		["lastLogin"] =,
		["level"] = 1,
		["exp"] = 0,
		["next"] = 25,
		["coins"] = 500,
		["gems"] = 0,
		["equipped"] = {"Scout Post", "Wooden Wall", "Empty", "Empty", "Empty"},
		["boardMaxX"] = 16,
		["boardMaxY"] = 16,
		["boardType"] = "Grass",
		["towersInv"] = defaultTowers,
		["boardsInv"] = defaultBoards

This code always reports a first login, even after successfully saving and re-loading the data.
And to be complete, here is the code I have for my HttpService:

local HttpService = game:GetService("HttpService")
success, err = pcall(function()
	local response = HttpService:RequestAsync({
		Url = "--[[address hidden]]",
		Method = "POST",
		Body = message
	if response.Success then
		print("Status code: ", response.StatusCode, response.StatusMessage)
		print("Response body: ", response.Body)
		print("Request failed: ", response.StatusCode, response.StatusMessage)

Again, the code is working fine for this. Here’s the results on my database:

I’ve tried commenting out the http code: no change.
I’ve tried disabling the http access in game settings: no change.

At this point I have absolutely no idea what is wrong or why this is happening, and no clue how to fix it.

Does anyone have an idea?

You do not need to pcall RequestAsync as it has it’s own response code of Response.Success and Response.StatusMessage. Removing pcall will ultimately reveal the error as pcall hides errors.

Thanks for the tip there, but my HttpService isn’t the issue. It works fine, no errors. It’s the DataStore not working.

OH MY GOD. I had a friend look over it and pointed out that in my Async calls I’m using player.userId and not player.UserId. I have no idea when that was changed, but obviously, that’s what caused the problem.

extreme headdesk