Edit: I got it working
Working script:
local function setAtmosphereColor(atmosphereColor1, atmosphereColor2, atmosphereColor3)
local tween = TweenService:Create(Lighting.Atmosphere, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Color = Color3.new(atmosphereColor1, atmosphereColor2, atmosphereColor3)})
tween:Play()
end
I NEED a function that changes the atmosphere. I am trying to make a toggleable button that changes the atmosphere color. Here are my attempts and the error I got. It would mean a lot if you helped me! :D
My attempt:
local function setTimeOfDay(clockTime)
local tween = TweenService:Create(Lighting, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), { ClockTime = clockTime })
tween:Play()
end --Works
local function setAtmosphereColor(atmosphereColor)
local tween = TweenService:Create(Lighting.Ambient, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), { Color = atmosphereColor})
tween:Play()
end --Doesn't work
Attempt to use the function:
dock.TimeDayToggle.Day.MouseButton1Click:Connect(function()
setTimeOfDay(12) -- Works
setAtmosphereColor(250, 250, 250) -- Doesn't work
dock.TimeDayToggle.Background:TweenPosition(UDim2.new(0, 0, 0, 0), "InOut", "Quad", 0.3, true)
end)
dock.TimeDayToggle.Night.MouseButton1Click:Connect(function()
setTimeOfDay(22) -- Works
setAtmosphereColor(20, 24, 24) -- Doesn't work
dock.TimeDayToggle.Background:TweenPosition(UDim2.new(0.5, 0, 0, 0), "InOut", "Quad", 0.3, true)
end)
Error: Unable to cast value to Object
The error comes from the function part.

1 comment
The second function is what I am looking for but the problem is it only changes the first value. Instead of doing 249, 249, 249 it does 249, 0, 0. This is what I did: setAtmosphereColor(0.98, 0.98, 0.98)