RemoteFunction returning data as NIL

Edit: Figured out my problem
Hello everyone! This is my first time using ProfileService and I’m getting an error.

I’m using a RemoteFunction to return the user’s data to the Client and for some reason, it’s getting returned as NIL. (Everything works perfectly in Studio but once I test it inside an actual server I get these errors)

Thanks!

EDIT: I figured it out what was the problem, thanks. How do I close a post?

Client Output

Server Output

updateTiles Function & getPlayersOwnedPermits (Client)

function getPlayersOwnedPermits() 
	local data = getDataRemote:InvokeServer()
	
	print(data["OwnedPermits"])
	
	if data then
		return data
	end
end
--------------------------------
function updateTiles()
	local myOwnedPermits = getPlayersOwnedPermits()
	
	local permits = Permits:GetChildren()
	
	for i = 1, #(permits) do
		if permits[i]:IsA("Frame") then
			if myOwnedPermits["OwnedPermits"][permits[i].Name] then -- Error here
------------
----------

Server

function retrieveData(player)
	local data = dataManager:Get(player)
	
	return data
end

getData.OnServerInvoke = retrieveData

Can you show what dataManager is?

Hello ScriptedSuper, thanks for the reply!

Heres some of the code. Let me know if you want the rest.

local ProfileStore = ProfileService.GetProfileStore(
	"Player",
	{
		Money = 0,
		Inventory = {},
		OwnedPermits = {},
		OwnedBags = {["Small Bag"] = {Equipped = true}}
	}
)

local Profiles = {}

function DataManager:Get(player)
	local profile = Profiles[player]
	
	if profile then
		print("Found Profile")
		return profile.Data
	end
end

Not really good with this type of stuff (I’ve never worked with profileservice but I skimmed through it) but try doing profile.data instead of profile.Data.

1 Like

Tried it and it throws me a similar error