Datastore thinking that its my first time playing the game

The datastore constantly prints “first” when I join the game regardless of it not being my first time playing the game - Studio access to api is on. No errors too

local dis = game:GetService("DataStoreService")
local rs = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local cafe_datastore = dis:GetDataStore("CafeDatastore")




local function saveData(player)
	local cafe_table = {
		["Currency"] = {
			["Coins"] = player.Currency.Coins.Value;
		};
	}
	print(player.Currency.Coins.Value)
	local success, errormessage = pcall(function()
		cafe_datastore:UpdateAsync(player.UserId, cafe_table)
	end)
end


local function loadData(player)
	local currency = Instance.new("Folder")
	currency.Name = "Currency"
	currency.Parent = player
	
	local coins = Instance.new("IntValue")
	coins.Name = "Coins"
	coins.Parent = currency

	local cafe_table
	local success, errormessage = pcall(function()
		cafe_table = cafe_datastore:GetAsync(player.UserId)
	end)

	if cafe_table then 
		coins.Value = cafe_table.Currency["Coins"]
	else
		print("first")
		coins.Value = 0
	end
end

game.Players.PlayerAdded:Connect(loadData)
game.Players.PlayerRemoving:Connect(saveData)
game:BindToClose(function()
	for _, player in pairs(game.Players:GetPlayers()) do  

		saveData(player)
	end
end)
if cafe_table then 
		coins.Value = cafe_table.Currency["Coins"]
	else
		print("first")
		coins.Value = 0
	end

A datastore works as it saves the data, what your trying to do is load nil data into the player. cafe_table.Currency wouldn’t be a thing. I am not good at datastores so I may be wrong…
I suggest looking at: Saving and Loading Data with DataStores - Scripting Helpers and seeing if that helps, if it doesn’t please let me know so I can help further.

As I said above, I am not good with datastores so I may be incorrect. But definitely read the scripting helpers post.

Hope I helped.

Aha your using the UpdateAsync, the second argument is the function where youll check for the correction of data, not the data it self, check the wiki pls

replace

local success, errormessage = pcall(function()
		cafe_datastore:UpdateAsync(player.UserId, cafe_table)
	end)

with

local success, errormessage = pcall(function()
		cafe_datastore:SetAsync(player.UserId, cafe_table)
	end)

Yes but this is just a band-aid, As this could cause data lost(experienced by me in my own game), I think he should use 2 seperate datastore 1 for the data saving and another for leaderstats