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

Why lua claim its a table not a string ? SOLVED

Asked by
ErtyPL 129
5 years ago
Edited 5 years ago

I have script as shown It shows a error but i dont understand it. (string expected, got table)

01script.Parent.MouseButton1Click:connect(function(buy)
02 
03    local mem = script.Parent.Parent.Parent.HDDMEM
04    local disk = Instance:new("Folder",mem) --[[idk 'string expected, got table']]
05    disk.Name = "disk" .. mem.diskNR.Value
06    local harddisk = Instance:new("NumberValue",disk)
07    harddisk.Name = "harddisk" .. mem.diskNR.Value
08    harddisk.Value = script.Parent.Parent.Parent.SUMA.suma.sumanv.Value
09 
10    mem.diskNR.Value = mem.diskNR.Value + 1
11    wait(0.01)
12while wait(0.1) do --[[while wait loop]]
13 
14    script.Parent.Parent.Parent.SUMA.suma.sumanv.Value = 0
15    script.Parent.Parent.Parent.SUMA.info.Text = (" ")
16    script.Parent.Parent.Parent.Memory.Buttons.Value = script.Parent.Parent.Parent.Memory.Buttons.Value .. script.Parent.Text
17    script.Parent.Parent.Parent.SKINSMENU.Visible = false
18    break
19end
0
It was later used in my code :D PROREMIXPL 60 — 3y

1 answer

Log in to vote
1
Answered by
Ankur_007 290 Moderation Voter
5 years ago

You're doing Instance:new(), which is syntax sugar for Instance.new(Instance). Since Instance itself is a table and Instance.new() takes a string for the class name, the error says string expected, got table. To fix this, just change all your Instance:new() to Instance.new()

Ad

Answer this question