Problem with DataStore

So this script prints succesful, yet it doesn’t ever actually load properly, even though it says it does.

local DataStoreService = game:GetService("DataStoreService")
local eliteStore = DataStoreService:GetDataStore("EliteTagStore")
local Players = game:GetService("Players")

Players.PlayerAdded:connect(function(player)
	local key = "Player_"..player.UserId
	local ValueFolder = Instance.new("Folder")
	ValueFolder.Parent = player
	ValueFolder.Name = "ValuesFolder"
	local EliteTagValue = Instance.new("IntValue")
	EliteTagValue.Parent = ValueFolder
	EliteTagValue.Name = "EliteTagValue"
	
	local data
	local sucess, errormessage = pcall(function()
		data = eliteStore:GetAsync(key)
	end)
	if sucess then
		EliteTagValue.Value = data
		print("Success")
	else 
		print("There was an error")
		warn(errormessage)
	end
end)

Players.PlayerRemoving:connect(function(player)
	local sucess, errormessage = pcall(function()
		local key = "Player_"..player.UserId
		local exitData = player.ValuesFolder.EliteTagValue.Value
		eliteStore:SetAsync(key,exitData)
	end)
	if sucess then
		print("Success")
	else 
		print("There was an error")
		warn(errormessage)
	end

end) ```

Please do not ask people to write entire scripts or design entire systems for you. If you can't answer the three questions above, you should probably pick a different category.
1 Like