So I have a local script and a configuration that’s supposed to change the properties in Lighting.
Basically how the local script functions is that it will go through all of the settings in the configuration and then set the matching lighting properties to said values. This was working about an hour ago and now its not for some reason. I even made it so it repeated until the script could confirm that the setting was in fact changed, but that didn’t work either. I even made it print the setting and the value to make sure it was working properly. My main issue is that ClockTime isn’t changing even though it said that it was changed.
for i,v in pairs(script.ConfigurationSpace:GetChildren()) do
repeat
wait()
game.Lighting:SetAttribute(v.Name,v.Value)
print(v.Name .. " " .. tostring(v.Value))
until game.Lighting:GetAttribute(v.Name) == v.Value
print(v.Name .. " " .. tostring(game.Lighting:GetAttribute(v.Name)))
end
print("ClockTime " .. game.Lighting.ClockTime)
Configuration:
Output:
Is there a better way to do this? Reminder that this script was working just fine a while ago and now isn’t working even though I haven’t changed anything
For context, I’m not familiar with working with Configurations or working with SetAttribute or GetAttribute
Clocktime isn’t changing because you’re changing the attributes not the properties?
Lighting.ClockTime isn’t an attribute, it’s a property. This means that your current script is setting an attribute with the exact same name instead of the property, but later you check the property instead of that (to check the attribute you should call GetAttribute as you do in the loop).
However in order to see the skybox and lighting respond to time (as you probably want) you need to modify the property ClockTime (not the attribute that you currently do). This means that you need to change the behavior of your loop so it reads and writes properties instead of attributes (by doing game.Lighting[propertyName] instead of game.Lighting:Get/SetAttribute(propertyName)).
For reference attributes are custom developer-set values for instances that are supposed to be accessed programmatically by your scripts (if you want to add extra info to an instance, configurations, metadata, etc), while properties are values that are built-in to an instance by default and the instance is using by default to change the game mechanics (such as in this case changing the time of day).
Thank you. I was basing this off of a different script and did the wrong thing without knowing
. I didn’t realize attributes and properties were different