Help with rainbow tween lighting script

As I don’t script that much, I’m probably gonna have to completely rely on you guys for this one. I would like to create a script that basically takes my original lighting property colors:

Ambient (70,70,70)
ColorShift_Bottom (0,0,0)
ColorShift_Top (255,255,255)
OutdoorAmbient (70,70,70)

and tweens them throughout the rainbow colors, with a duration of 8 seconds, tweening back to the original colors afterwards. Thanks to anyone that helps out with this.

1 Like

You can use Color3.fromHSV() for this.

local Lighting = game:GetService("Lighting")
local TweenService = game:GetService("TweenService")

local defAmbientColor = Lighting.Ambient
local defBottomColor = Lighting.ColorShift_Bottom
local defTopColor = Lighting.ColorShift_Top
local defOutdoorColor = Lighting.OutdoorAmbient 

local value = 1
local saturation = 1

local tweenProps = {
Ambient = Color3.fromHSV(1,saturation,value),
ColorShift_Bottom = Color3.fromHSV(1,saturation,value),
ColorShift_Top = Color3.fromHSV(1,saturation,value),
OutdoorAmbient = Color3.fromHSV(1,saturation,value),
}
local colorTween = TweenService:Create(Lighting,TweenInfo.new(8, Enum.EasingStyle.Linear),tweenProps)
colorTween:Play()
colorTween.Completed:Wait()

Lighting.Ambient = defAmbientColor
Lighting.OutdoorAmbient = defOutdoorColot
Lighting.ColorShift_Bottom = defBottomColor
Lighting.ColorShift_Top = defTopColor
1 Like

i don’t think you defined “hue”

actually nevermind, you just adjust the hue for different colors, i got it, thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.