OnServerInvoke - Player argument is equal to nil

  • Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.

In my Google Analytics service I see that sometimes the first argument of OnServerInvoke (The Player instance) is equal to nil. I have literally no clue how that is happening, we are doing nothing weird (We don’t parent our RemoteEvents to nil or something in that nature.)

  • How often does the bug happen (Everytime/sometimes/rarely)? What are the steps that reproduce the bug? Please list them in very high detail. Provide simple example places that exhibit the bug and provide description of what you believe should be the behavior.

Rarely. Currently I have 20 - 30 events of the issue in a time span of 30 minutes.

  • Where does the bug happen (www, gametest, etc) Is it level-specific? Is it game specific? Please post a link to the place that exhibits the issue.


  • When did the bug start happening? If we can tie it to a specific release that helps us figure out what we broke.

It started happening in the last days… Hard to pinpoint a time to it.

If you need any information, please ask.

  • Velibor
1 Like

I have reviewed the code and we appear to have correct general safeguards for only calling the function for OnServerInvoke with a non-null player. There is a definite bug if the RemoteFunction is not currently inside the DataModel when InvokeServer happens, is it possible that some code is triggering InvokeServer while your game is being closed/cleaned up? Are there any transition cases where RemoteFunctions are added or removed from the game?

1 Like

Adding to what @LordRugdumph said, do you have remotes in any Workspace objects that might get destroyed? Characters?

This is the only case I know of where it would be nil if the client sets the remote event parent to nil. This could be down to someone running code on the client side.

source post