and would like to loop through these values, find the property in lighting from the name of the value, and then set the property to the value inside.
The problem is, I keep getting this error, as if it was looking for a child object of Lighting rather than a property.
i am using this code block to accomplish this:
for _, i in pairs(Map.GameSettings:GetChildren()) do
if game:FindFirstChild(i.Name) then
local Service = game:GetService(i.Name)
for _, j in pairs(i:GetChildren()) do
Service[j.Name] = j.Value
end
end
end
The error occured with the LegacyOutlines variable as well. (the previous time it read the LegacyOutlines variable first, i tried removing it and then got this error with Technology)
Adding onto what previous users said, please make sure you research! If you go to Lighting.Technology on the Developer Hub, you can see that it states in a large red box at the top of the page that you cannot change this property from a script.
Try this;
for _, i in pairs(Map.GameSettings:GetChildren()) do
if game:FindFirstChild(i.Name) then
local Service = game:GetService(i.Name)
function WriteVariable(Name, Value)
Service[Name] = Value
end
for _, j in pairs(i:GetChildren()) do
if pcall(WriteVariable(j.Name, j.Value)) do
--We have succeeded.
else
--"Ah we failed!"
print("Can't write or read", j.Name)
end
end
end
end
That’s not how you pcall a function. That will call WriteVariable and pcall what it returns, since you call it directly instead of passing the function itself to pcall. It’s also if condition then, not if condition do. Here’s what this line should look like: if pcall(WriteVariable, j.Name, j.Value) then