I’m currently working on a module script that connects to a regular script to change the color of lights. The first light change works, but the second after task.wait(4)
doesnt. How can I fix this?
Module:
local TweenService = game:GetService("TweenService")
local Helper = {}
function Helper.adjustLights(descendantsTable, objType : string, tweenInfo : TweenInfo, brightnessValue : number)
for i,v in pairs(descendantsTable) do
if v:IsA(objType) then
TweenService:Create(v, tweenInfo, {Brightness = brightnessValue}):Play()
end
end
end
-- SCRIPT USED FOR COLOR:
function Helper.adjustcolor(descendantsTable, objType: string, tweenInfo : TweenInfo, colorValue)
for i,v in pairs(descendantsTable) do
if v:IsA(objType) then
TweenService:Create(v, tweenInfo, {Color = Color3.fromRGB(colorValue)}):Play()
end
end
end
return Helper
Script:
local servScriptServ = game.ServerScriptService
local helper = require(servScriptServ.Helper)
task.wait(4)
helper.adjustcolor(workspace.Light:GetDescendants(), "SpotLight", TweenInfo.new(3, Enum.EasingStyle.Sine), 255, 0, 0)
task.wait(4)
helper.adjustcolor(workspace.Light:GetDescendants(), "SpotLight", TweenInfo.new(3, Enum.EasingStyle.Sine), 136, 255, 0)
print("Color Changed")
“Color Changed” still prints so I’m unsure what my error is. The color simply just fades instead of changing.