Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

string expected, got table, what does that mean?

Asked by 3 years ago

i tried to make a leaderstats but it did not work, it said "string expected, got table", what does that means?

2 answers

Log in to vote
0
Answered by
l_diue 30
3 years ago

This is how you properly create leaderstats. Not sure if this is what you were referring to since your question was vague.

--CODE

--DO NOT FORGET TO DEFINE WHO THE PLAYER IS!!

local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
0
Please notify me on discord if you have extra questions :) thomas!#5374 l_diue 30 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

That means you passed or put in table instead of string -- table is something like (cat, dog, lizard), containing several values. String is something typed in words - like "Hello, I am Lukas".

You may accidentally used wrong variable, which contains table instead of string. If you requested it from data store it will return it in table form, that means you will need to access it in that way:

for i, v in pairs(table) do
    -- table is {cat, dog, lizard}
    print(v)
end

-- output - cat   dog   lizard

0
ok but i told you i made a leaderstat dante_dalmatian 9 — 3y

Answer this question