InvokeServer not working at all

What the title says. I’m using ForeverHD’s crate spin system. I did not modify anything (Besides porting the leaderstats to use ProfileService so I can save them when player leaves, but I’ve been checking for 3 days straight and there is no error, no code missing, and everything is where it should be so there is no problem with that.) and when I press the spin button, it stays in the “Processing” state.

image
Line 227 doesn’t run, as the script prints “loading”, but not “local get”, + the print command i put in the start of the rfunction does not run (it doesnt print anything) so it straight up isnt invoking the server or whatever.

any help appreciated.

Make sure the server returns something. Otherwise, the local script will wait for a response. Can you show the server script?

Hi, thanks a lot for the fast reply :smile:

This is the beginning of the rfunction (it’s very long and will not fit into an image, the rest is literally just the original code from ForeverHD’s system but modified to work with ProfileService but then again, the rfunction straight up doesn’t load, as the print at the beginning doesn’t even run.
image

image
and this is permissiontospin (inside a modulescript)

Honestly, I’ve never used

function remotefunction.OnServerInvoke(player)

as a way to receive remote function invokes, but it may work. But, could you still try

rfunction.OnServerInvoke = function(player)

If that doesn’t work, could you send what is running before the OnServerInvoke connection? It may be something delaying the line from running.

Tried it out, same result though

Alright, could you show what runs before the OnServerInvoke?

Actually, now that you mentioned it, I remember that the OnServerInvoke runs inside of a PlayerAdded event so it can be compatible with ProfileService, but I’ll see if somehow putting it outside of the PlayerAdded event will work

The problem is that the client is running InvokeServer and there is no initialized OnServerInvoke to receive it. You probably have some yield before the the OnServerInvoke function gets connected.

There should only ever be one time where you assign a function to OnServerInvoke, and since the function gets the Player instance sent as an argument, you should not be putting it inside of a PlayerAdded function anyway. Best of luck

image
what does the “attempt to perform arithmetic (add) on nil and number” mean? i googled it and i dont really understand

That means something is nil, and you are trying to add a number to it. Ex:

print(nil + 10)