(SOLVED )RemoteFunction ServerInvoke not received by Server

I simply need to check if a player has any saved data, and the Entry Menu to act accordingly.
I have a RemoteFunction “Profile” stored in a folder in Replicated Storage, the client invokes it, and the server checks to see if they have played before.

Oddly enough, nothing happens, and I find out that the server function is not even running to begin with.

Client Script:

local UserProfile = Events.Profile:InvokeServer()
if UserProfile ~= nil then
    --load
else
    --(removed for simplicity)
end

Server Script:

function GetProfile(player)
	local Name = player.Name
	if _G.PLAYER_DATA[Name] == nil then return nil end
	if _G.PLAYER_DATA[Name].Data.Profile.RPName == "" then return nil end
	return _G.PLAYER_DATA[Name].Data.Profile
end

Events.Profile.OnServerInvoke = GetProfile

I have troubleshooted the issue to find that all loops in any involved script does not yield forever, and allows the client to invoke the server with Profile. I also know that the client does invoke the server, but the GetProfile function does not run.

Is this an issue with the engine, or am I missing something?

EDIT: The Interface that handles player currency is also not working properly, which may indicate that all of the RemoteFunctions (and possibly Events) are not being handled by the server either.

2 Likes

I have 2 possible answers.

The first one is you didn’t save/load the data correctly.
The second option which is likely not true is the usage of _G.

Do you have multiple scripts handling the same .OnServerInvoke? You can only have 1 function assigned to it at a time.

1 Like

Nope. As of now that is the only server script in the game, and is therefore the only one using the remote function.

Add in some print statements just before the client sends the request to the server, and when the server receives that request. The information you’ve provided isn’t enough to figure out what’s wrong.

First you need to know if it’s the client’s fault or the server’s fault.

That is how I found out that it is the server’s fault; the client invokes, and the corresponding function in the server script does not fire.

Is there any code yielding on the server that prevented the server from setting the function to invoke?

All the involved scripts do not yield

I am having the exact same issue. This seems to work as long as it isn’t in a folder, which is a pain.

I am a bit embarrassed to say that the issue was that is in one of the event connections, I forgot to use OnServerEvent and directly used Connect to the RemoteEvent object, which hindered the other connections.

1 Like