Attempt to index nil with 'data'

You can write your topic however you want, but you need to answer these questions:

I am having issues with referencing a variable inside a folder called data, which is parented by the player. When ever I try to run the code I get the error "attempt to index nil with ‘data’ ", on line 42. The script is a normal script inside the SeverScriptService.

I have looked at similar posts but was having issues finding a workable solution.

LocalPlayer cannot be referenced on the server, it is returned as nil. You need to reference the values inside the functions that change them or inside the PlayerAdded function, and have the plr passed as an argument

2 Likes

As someone already said, you can’t reference the LocalPlayer in a server script.