Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why lua claim its a table not a string ? SOLVED

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

script.Parent.MouseButton1Click:connect(function(buy) 
	
	local mem = script.Parent.Parent.Parent.HDDMEM
	local disk = Instance:new("Folder",mem) --[[idk 'string expected, got table']]
	disk.Name = "disk" .. mem.diskNR.Value
	local harddisk = Instance:new("NumberValue",disk)
	harddisk.Name = "harddisk" .. mem.diskNR.Value
	harddisk.Value = script.Parent.Parent.Parent.SUMA.suma.sumanv.Value
	
	mem.diskNR.Value = mem.diskNR.Value + 1
	wait(0.01)
while wait(0.1) do --[[while wait loop]]

	script.Parent.Parent.Parent.SUMA.suma.sumanv.Value = 0
	script.Parent.Parent.Parent.SUMA.info.Text = (" ")
	script.Parent.Parent.Parent.Memory.Buttons.Value = script.Parent.Parent.Parent.Memory.Buttons.Value .. script.Parent.Text
	script.Parent.Parent.Parent.SKINSMENU.Visible = false
	break
end

1 comment

0

It was later used in my code :D

1 answer

✓ Accepted answer

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()

This discussion is preserved as it was. New answers, comments, and votes are closed.