For some reason after my tween, my text goes white for some time

Basically, I made a hover over system, where the text will change colors.

Now, it works, but the biggest issue is related to what happens after the tween.

The related script is this:

	for _, button in pairs(Pattern.CanvasGroup:GetDescendants()) do
		if button:IsA("TextButton") then
			button.MouseEnter:Connect(function()
				TS:Create(button, TI, {TextColor3 = Color3.fromRGB(69, 255, 66)}):Play()
			end)

			button.MouseLeave:Connect(function()
				TS:Create(button, TI,  {TextColor3 = Color3.fromRGB(0, 0, 0)}):Play()
			end)
		elseif table.find(ClickedButtons, button) then
			return 			
		end
	end
1 Like

Is there any other script that changes the text color?

Also, you should be using continue instead of return if you want to just skip to the next loop instead of breaking the loop.

New code:

for _, button in pairs(Pattern.CanvasGroup:GetDescendants()) do
	if button:IsA("TextButton") then
		local textColor = button.TextColor3
		
		button.MouseEnter:Connect(function()
			TS:Create(button, TI, {TextColor3 = Color3.fromRGB(69, 255, 66)}):Play()
		end)

		button.MouseLeave:Connect(function()
			TS:Create(button, TI, {TextColor3 = textColor}):Play()
		end)
	elseif table.find(ClickedButtons, button) then
		continue
	end
end
1 Like

This is the only script that utlizes TextColor3, so no there are no new scripts that change text colors, which makes this issue weirder for me.

1 Like

What is the TI variable? There might be something there that it changes. Make sure it has:

Tween Time,
Easing Style,
Easing Direction,
0,
false,
0

local TI3 = TweenInfo.new(2, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, true)

It may be the back, so I’ll check back and edit this response.

Alright, so I changed back to Cubic and easing direction Out, but it still seems to be changing back to white.

local TI3 = TweenInfo.new(2, Enum.EasingStyle.Back, Enum.EasingDirection.In, 0, false,0)

The issue still stands. I don’t add the last part because the default is 0, but I added your version of it and the same occurance happened.

Because you’re using back easing style. This makes values go over 255 and under 0 causing the values to be relocated. For example, if you do 255 + 5 it would be 5. Subsequently, a value of 0 - 5 would return 250, which is basically white.
image
As you can see it starts at 0, then goes under 0.

Use something other than this easing style.

1 Like