"Attempt to call a table value"

I’ve been getting this error, and cannot seem to find a way to fix it.

This is the line of code thats causing the issue.

coroutine.wrap(function()
	for _,Button in pairs(script.Parent.SettingEditor.Background.Entrance:GetChildren()) do
		if Button:IsA("TextButton") then
			Button.MouseButton1Click:Connect(function()
				UnColorOtherFrames("Entrance")
				Button.BackgroundColor3 = Color3.fromRGB(58,255,58)
				game.ReplicatedStorage.DataEvents.SaveQuickData:InvokeServer({Type = "Entrance",Data = Button.Name})
			end)
		end
	end
end)()```

The Error: 
' attempt to call a table value'

Still getting the same error, which is weird, because both ways should work.

Fixed it, An error in the module.

local Entrance = script.Parent.SettingEditor.Background.Entrance
local RS = game:GetService("ReplicatedStorage")
local Save = RS:WaitForChild("DataEvents"):WaitForChild("SaveQuickData")

coroutine.wrap(function()
	for _, Button in ipairs(Entrance:GetChildren()) do
		if Button:IsA("TextButton") then
			Button.MouseButton1Click:Connect(function()
				UnColorOtherFrames("Entrance")
				Button.BackgroundColor3 = Color3.fromRGB(58,255,58)
				Save:InvokeServer({Type = "Entrance",Data = Button.Name})
			end)
		end
	end
end)()

I know you’ve fixed it but this is what you should do.

1 Like