Hey all! I have a simple tween script to change the color of a part depending on the time of day. There are no errors or anything that comes up wrong when the script plays ingame, but the color of the part does not change whatsoever. I'm unsure if its because the color3.fromRGB is incorrect, or if there is another way I should make the tween. Here is the code:
local part = script.Parent
local Info = TweenInfo.new(1)
local Tween = game:GetService("TweenService"):Create(part,Info,{Color = Color3.fromRGB(0, 0, 0)})--Nighttime
local Info2 = TweenInfo.new(1)
local Tween2 = game:GetService("TweenService"):Create(part,Info2,{Color = Color3.fromRGB(159, 161, 172)})--Daytime
if game.Lighting:GetMinutesAfterMidnight() > 17.2 * 60 then --Checks Nighttime
Tween:Play()
end
if game.Lighting:GetMinutesAfterMidnight() > 7 * 60 then --Checks Daytime
Tween2:Play()
end
Unsure of what I should change as the script seems to be okay otherwise! Thank you very much!
Edit : Part is a union if that changes anything! The union has UsePartColor on! Thanks! I actually also changed and added a print function to check when it is daytime or nighttime to show me whether or not it works. It shows that it prints out the Daytime check, but not Nighttime. Here is the new script :
local part = script.Parent
local Info = TweenInfo.new(1)
local Tween = game:GetService("TweenService"):Create(part,Info,{Color = Color3.fromRGB(0, 0, 0)})--Nighttime
local Info2 = TweenInfo.new(1)
local Tween2 = game:GetService("TweenService"):Create(part,Info2,{Color = Color3.fromRGB(159, 161, 172)})--Daytime
if game.Lighting:GetMinutesAfterMidnight() > 17.2 * 60 then --Checks Nighttime
print("BrickNightCheck")
Tween:Play()
else
if game.Lighting:GetMinutesAfterMidnight() > 7 * 60 then --Checks Daytime
print("BrickDayCheck")
Tween2:Play()
end
end
