Problems with saving values... [NEED HELP]

So I don’t understand why it doesn’t work. The values add up, no errors pop up, but the script doesn’t print anything in the console + and it doesn’t save my data. I am struggling with this for some time and I couldn’t find a solution anywhere. My script is below:

local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local ServerCreator = DSS:GetDataStore("ServerCreator")

local function AddPlr(Plr)
	
	local servercreator = Instance.new("Folder")
	servercreator.Name = "ServerCreator"
	servercreator.Parent = Plr
	
	local servername = Instance.new("ObjectValue")
	servername.Name = "ServerName"
	servername.Parent = servercreator
	
	local gamemode = Instance.new("NumberValue")
	gamemode.Name = "Gamemode"
	gamemode.Parent = servercreator
	
	local difficulty = Instance.new("NumberValue")
	difficulty.Name = "Difficulty"
	difficulty.Parent = servercreator
	
	local code = Instance.new("NumberValue")
	code.Name = "Code"
	code.Parent = servercreator
	
	local host = Instance.new("ObjectValue")
	host.Name = "Host"
	host.Parent = servercreator
	
	local PotentialData
	local success, whoops = pcall(function()
		PotentialData = ServerCreator:GetAsync(Plr.UserId)
	end)

	if success and PotentialData then
		servername.Value = PotentialData.servername
		gamemode.Value = PotentialData.gamemode
		difficulty.Value = PotentialData.difficulty
		code.Value = PotentialData.code
		host.Value = PotentialData.host
		print("Data successfully loaded for Player:", Plr)
	else
		warn("Error attempting to load the data:", whoops)
	end
	
end

local function RemovePlr(Plr)
	local servername = Plr:WaitForChild("ServerCreator"):WaitForChild("ServerName")
	local gamemode = Plr:WaitForChild("ServerCreator"):WaitForChild("Gamemode")
	local difficulty = Plr:WaitForChild("ServerCreator"):WaitForChild("Difficulty")
	local code = Plr:WaitForChild("ServerCreator"):WaitForChild("Code")
	local host = Plr:WaitForChild("ServerCreator"):WaitForChild("Host")

	local DataToSave = {
		ServerName = servername.Value,
		Gamemode = gamemode.Value,
		Difficulty = difficulty.Value,
		Code = code.Value,
		Host = host.Value
	}

	local success, whoops = pcall(function()
		ServerCreator:SetAsync(Plr.UserId, DataToSave)
	end)

	if success then
		print("Data successfully saved for Player", Plr)
	else
		warn("Error attempting to save the data:", whoops)
	end
end

Players.PlayerAdded:Connect(AddPlr)
Players.PlayerRemoving:Connect(RemovePlr)

Need fast help, please! Thanks.

I seriously suggest switching to DataStore2. It’s surprisingly much easier than using Roblox’ own system, as far as I can see, there’s no problem here, although I haven’t analyzed hard enough. One more thing, have you even enabled HTTP Services in your Studio Settings?

I only have API on. I am going to activate HTTP right now.

Sorry never mind that, it’s API not HTTP, my apologies

Yea I was confused with what HTTP has to do with datastoreservices

What should I change at the script so I change to DataStore2?

One more thing, when you load in, you have to give the player the default data if they don’t already have it. Not sure that’s your issue either, since you mentioned it not printing or erroring anywhere.

So when its searching for the data I have to put or default at the end? But I don’t think that’s the problem since the default data is always 0 or empty box, depending on what value I have.

You’d have to get a copy of DataStore2, you can get it off Kampfarren’s github. Get the latest release and read the API for it on their website.

Well, if there’s no data returned, then most likely?

Alright I will look into it and come back to tell the results.

Best of luck! CHARACTER LIMIT…