Remote Function doesn't return data

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("Test2")
local RequestData = script.Parent:WaitForChild("RequestData")

script.Parent.RequestData.OnServerInvoke = function(ClientName, Name)

	local success, Data = pcall(function()
		return DataStore:GetAsync(Name)
	end)

	if not success then
		warn("Error!")
	end
	
	return Data
end

That is the server script which gets the data and then returns it back the the local script. The problem is that the returned data doesn’t “arrive” at the local script. The data is a saved table.

The line of code which should get the returned data:

local Data = RequestData:InvokeServer(PlayerName)

Did you make sure that you load the data with the correct key?

Yes, I tested it with printing the data in the server script (the big part of the code) and it printed the correct data.

Huh weird, your code seems fine. Try testing this in a real game instead of studio?

I used to get this issue with a game I had from a long time ago, what I think the issue was in my game might be the same for your issue, you could be taking up too much memory, with other functions and
calls at the same time which could lead to your RemoteFunction not being able to actually
return any data.