I just need to find a way to have modules that store a Color3.New() to be added to a tweenserivce
local moduleSetings = require(game.ReplicatedStorage.Module["Lighting/Weather"])
local tween = game:GetService("TweenService")
local lighting = game.Lighting
local timeofday = lighting.ClockTime
local SunRise = TweenInfo.new(moduleSetings.MystWeather.Timer.SunRise_time,Enum.EasingStyle.Quad)
local SunSet = TweenInfo.new(moduleSetings.MystWeather.Timer.SunSet_time,Enum.EasingStyle.Quad)
--lighting [[tweens are only settings that have a day or a night variant]]
local LightAmbiant_D = tween:Create(lighting.Ambient,SunRise,{Color = Color3.new(moduleSetings.Light.Lighting.Ambient_D)})
local LightAmbiant_N = tween:Create(lighting.Ambient,SunSet,{Color = moduleSetings.Light.Lighting.Ambient_D})
When creating a Tween, the 3 things that are supposed to be input into TweenService:Create() are:
The Instance that is being updated
The TweenInfo
The goal for the properties you want to update (contained within a table)
However, when you created the LightAmbiant_D and LightAmbiant_N tweens, you started by referencing the property of the Lighting service rather than the Lighting service itself. The property you want to update is meant to be included in the “goal” table at the end. Currently, the goal mentions “Color”, but that is not the exact name of any existing properties of the Lighting service.
Since it seems like you were trying to update the Ambient property of the Lighting service to a new Color3 value, here is an example revision that corrects the code to achieve that:
Example revision
local LightAmbiant_D = tween:Create(lighting,SunRise,{Ambient = Color3.new(moduleSetings.Light.Lighting.Ambient_D)})
local LightAmbiant_N = tween:Create(lighting,SunSet,{Ambient = moduleSetings.Light.Lighting.Ambient_D})
--[[
I also noticed that Color3.new is only included for the goal
of the first tween but not the second one.
If you encounter an error with the second tween, it likely needs to
be updated to the following:
--]]
local LightAmbiant_N = tween:Create(lighting,SunSet,{Ambient = Color3.new(moduleSetings.Light.Lighting.Ambient_D)})
--[[
Or, if `moduleSetings.Light.Lighting.Ambient_D` already stores a reference to
a Color3.new() call, then the first tween may need to be revised to this:
--]]
local LightAmbiant_D = tween:Create(lighting,SunRise,{Ambient = moduleSetings.Light.Lighting.Ambient_D})
And another extra thing; the second tween you created, LightAmbiant_N, is referencing moduleSetings.Light.Lighting.Ambient_D. If you meant for it to reference an Ambient_N you stored in that module, then make sure to update that accordingly so it’s not tweening the Ambient property to the same values as the first one.
Yup! That’s because it already knows which object it needs to update from the first thing you add to Tween:Create(), so all you need to do at the end is to tell it which properties need to be updated and to what values.