Attempt to index number with 'Value' for a leaderstat

Ive got multiple leaderstats in the game which work fine, however when adding a new one I get this error message;
image

With this being the line in question;
image

This is where the leaderstat level is made:
image

1 Like

Out of curiosity what is levelData currently defined as?

image

1 Like

Just removing .Value should work. The error says you’re trying to index a number, so that means levelData already represents the value you’re looking for. In this case you would only need .Value if your variable represented a NumberValue object.

That worked (as well as for the xp) though im curious as to why its the case for those 2 stats and not the rest which are all the same

image

All those work with no errors

Check how you’re saving the stats in DataStore. In levelData you might be saving just the number but for the others you might be saving the actual object of the value.