Value in Table won't convert to Integer, despite already being an Integer

I’m trying to save data for players in my game, and I followed a tutorial that told me to do this setup in my script:

But when I run it, it gives me this error:

image

The reason I’m confused is because plrData.Essence isn’t a table, it’s (supposed to be) an Integer. I have to be missing something, so I’m asking for help on here because I tried for 2 hours to fix this one little problem but I couldn’t.

Also, apologies if my code’s sloppy, I mostly have no idea what I’m doing

im guessing you are saving the table in a datastore. to do so you need to encode when saving, and decode when retrieving it

I tried doing a JSONDecode and JSONEncode but it gave the same error

FIXED IT! ignore this post unless you have the same problem

all I did was add this:


and it worked just fine

The problem was that it kept reading it as a table, even though I wanted it to read it as an integer within the table. So i just treated it like a table as well. :+1:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.