Remote Function returning any provided value nil

Hello again…

I’m still working on this getProfile function from my last post, and I was able to get my player’s data table loaded. However, when sending it over, I noticed the client received nil rather than the table. Even when printing the table in my server script, it provided all of the necessary information, but after some messing around in what my script returned, everything seemed to be nil. I checked out some other posts and couldn’t find anything relating to my issue.
image
image
(ignore the new table stuff, desperate attempt to send over a different table with the same values)

Any help is appreciated, since I have literally no idea what’s going on, whether I can send this or not…

Please start sending your complete scripts from hereon. It is harder to diagnose your issue if you tunnel-vision the experts. How are you receiving the data from the server?

Right.

Here’s the remote event function:

remotes.getProfile.OnServerEvent:Connect(function(player, playerName)
	if game.Players:GetUserIdFromNameAsync(playerName) then
		
		local key = 'Player_'.. game.Players:GetUserIdFromNameAsync(playerName)
		
		local success, data = pcall(store.GetAsync, store, key)
		
		if success then
			if data then
				print('PROFILE FROM REMOTE: '..tostring(store:GetAsync(key).Data))
				
				local newTable = {}
				for _, data in store:GetAsync(key).Data do
					table.insert(newTable, data)
				end
				print(newTable)
				
				return 'Peekaboo!' -- should be player profile | store:GetAsync(key).Data
			else
				warn('Could not get player profile for '..playerName)
			end
			else
			warn('Failed to get data for '..playerName)
		end
		
	end
end)

And just about everything relevant for the client side:

if enterpressed then
		local user = userInput.Text
		
		if user and game.Players:GetUserIdFromNameAsync(user) then
			local playerId = game.Players:GetUserIdFromNameAsync(user) :: number
			
			local profile = getProfile:FireServer(user)
			print('PROFILE RECEIVED ON CLIENT: '..tostring(profile))
			if not profile then warn('Could not get profile for '..user) return end

You’re completely mistaken on how this instance operates. You’re looking for a RemoteFunction, not a RemoteEvent. I encourage you to read the remote events and callbacks documentation page

1 Like

Oh, haven’t really familiarized myself with RemoteFunctions. Thank you for the clarification.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.