Block not turning the right color

Why does this keep turning my block white? I am trying to set it to a darker shade of green…

local color = BrickColor.new("Lime green")
local sub = 0.1
local darkershade = Color3.new(color.Color.R-sub,color.Color.G-sub,color.Color.B-sub)

local tweenService = game:GetService("TweenService")
local tweenInformation = TweenInfo.new(6) -- Time1
local ColorProperty = {}
ColorProperty.Color = color.Color
local ColorProperty2 = {}
ColorProperty2.Color = darkershade


local tween1 = tweenService:Create(game.Workspace["Roblox Logo"].Logo,tweenInformation,ColorProperty) --create a smooth transsition
tween1:Play() --play the transition.

local tween2 = tweenService:Create(game.Workspace["Roblox Logo"].Back,tweenInformation,ColorProperty2) --create a smooth transsition
tween2:Play() --play the transition.

It has something to do with tween Service. How can I fix this problem?

1 Like

You have to wait between tweens if you want one to play after another. Use Tween.Completed:Wait() then play the next tween.

It can also happen because your Color values are going over 1 or under 0. Clamp your values.

It did not work. ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ

I believe BrickColor.new returns RGB values. so darkershade would have to be Color3.fromRGB instead of Color3.new

SO HOW CAN I FIX THE ISSUE?. ive already tried that.
ㅤㅤ
ㅤㅤ
sAdsghfml,nsh,s;/s nslh jslh.ds/h,. s.hjadk h.j,cn.det s

You mix up the solutions @GamesAllRuined and @VegetationBush posted.

local color = BrickColor.new("Lime green")
local sub = 0.1
local darkershade = Color3.fromRGB(color.Color.R-sub,color.Color.G-sub,color.Color.B-sub)

local tweenService = game:GetService("TweenService")
local tweenInformation = TweenInfo.new(6) -- Time1
local ColorProperty = {}
ColorProperty.Color = color.Color
local ColorProperty2 = {}
ColorProperty2.Color = darkershade


local tween1 = tweenService:Create(game.Workspace["Roblox Logo"].Logo,tweenInformation,ColorProperty) --create a smooth transsition
tween1:Play() --play the transition.
tween1.Completed:Wait()

local tween2 = tweenService:Create(game.Workspace["Roblox Logo"].Back,tweenInformation,ColorProperty2) --create a smooth transsition
tween2:Play() --play the transition.

Still didnt work? I am pretty sure both solutions are included right?

What about the Tween duration argument?

Tweens tend to be a pain in the back to debug, I have dealt with that before

Shouldn’t it be:

ColorProperty.Color = color

Not sure how you would get the color of a color, but I could be wrong.

1 Like

‘color.Color’

ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ
ㅤㅤ

I am saying, isn’t Lime green already a color?

The reason the part is turning white is because you’re subtracting from each color channel and getting a number smaller than 0. Try a math.clamp() on each color channel. The color you’re getting is: -0.1, 0.9, -0.1

local darkershade = Color3.new(math.clamp(color.Color.R-sub, 0, 1), math.clamp(color.Color.G-sub, 0, 1), math.clamp(color.Color.B-sub, 0, 1))
1 Like

So? Did you add the duration argument to your Tween?

local color = BrickColor.new("Lime green")
local sub = 0.1
local darkershade = Color3.fromRGB((color.r-sub)*255,(color.g-sub)*255, (color.b-sub)*255)

local tweenService = game:GetService("TweenService")
local tweenInformation = TweenInfo.new(6)
local ColorProperty = {}
ColorProperty.Color = color.Color
local ColorProperty2 = {}
ColorProperty2.Color = darkershade


local tween1 = tweenService:Create(game.Workspace["Roblox Logo"].Logo,tweenInformation,ColorProperty)
tween1:Play() 
tween1.Completed:Wait()
local tween2 = tweenService:Create(game.Workspace["Roblox Logo"].Back,tweenInformation,ColorProperty2)
tween2:Play() 

The .Color property of BrickColor returns a Color3 of that BrickColor. So in the case of BrickColor(“Lime green”) it returns Color3.new(0, 1, 0)