This script is supposed to grab all of the bricks inside of the appropriate folder, but it keeps returning an error telling me it's expecting a table instead of an object. I am AWFUL at working with this "in pairs" stuff. Can someone help?
func = function( p ) -- functions go HERE
print(p.Name .. " toggled privacy mode")
if privacymodeon == false then
game.Workspace.FaraVoice.Value = "Very well, sir."
for i, v in pairs(game.Workspace.FaradayHouse.Body.Windows) do
if v:IsA("BasePart") then
if v.Name == "Glass" then
v.Transparency = 0.1
end
end
end
end
if privacymodeon == true then
game.Workspace.FaraVoice.Value = "Privacy mode is now off, sir."
for i, v in pairs(game.Workspace.FaradayHouse.Body.Windows) do
if v:IsA("BasePart") then
if v.Name == "Glass" then
v.Transparency = 0.6
end
end
end
end
end

2 comments
Can we have what line the error is on?
Line 5, so assumedly like 14 would have it, too.