Error When Retrieving Player Key in Data Set Function

I’m trying to get a player’s UserId using this function that holds the array of all the player id’s in the server. However, it gives me this error, implying that one of the indexes is nil. I’m assuming that this is the key variable, but I don’t know how to go about changing it.

Here’s the function and the error, any advice?


??? why is your key the players service???

make your key the player variable’s userid or something

e.g.

local key = player.UserId

Just tried it again, got the same issue. That was the original line for my code, the code above was my second attempt at it, when I tried going through the server end.

Here’s the function and error again.
function2

This means you have not given the script the player variable
Could you show me part of your script where you called this function

e.g

require(workspace.ThisIsAnExample):boop('abc')

I called it in two instances here. This setup function gets the players instance as its argument that enables it to run datamod.set().

Here ya go:
function3

My apologies for the extremely late response. Probably has something to wtih this

image

Try removing that one line