Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to smoothly tween the color of textbutton?

Asked by
HaveASip 494 Moderation Voter
4 years ago
Edited 4 years ago

Hey guys! Hope you are doing well.

Few minutes ago I was trying to make a smoothly text color tween, but something went wrong and now I have no idea what to do.

If you guys have some ideas, please let me know.

Here is the code:

local TweenService = game:GetService("TweenService")
local TweeningObject = script.Parent
local TweenInformation = TweenInfo.new(
    .5,
    Enum.EasingStyle.Quad,
    Enum.EasingDirection.Out,
    753475938457843579348573,
    true,
    0
)


local oldTween

script.Parent.MouseEnter:Connect(function()
    if oldTween then
        oldTween:Cancel()
    end
    oldTween = TweenService:Create(TweeningObject, TweenInformation, {Color = Color3.fromRGB(213, 115, 61)})
    oldTween:Play()
end)

script.Parent.MouseLeave:Connect(function()
    if oldTween then
        oldTween:Cancel()
    end
    oldTween = TweenService:Create(TweeningObject, TweenInformation, {Color = Color3.fromRGB(255,255,255)})
    oldTween:Play()
end)
0
Instead of Color3,new, use Color3.fromRGB since your arguments are from 0 to 255, not 0 to 1. saSlol2436 716 — 4y
0
For the amount of times to repeat you could just use math.Huge Fad99 286 — 4y
0
I've replaced it, but it's not working anyway! In output it says: TweenService:Create no property named 'Color' for object 'TextButton' HaveASip 494 — 4y

Answer this question