The color i'm wanting to fade is green to white (On click it turns green then i want it to fade to white.)
COMMUNITY QUESTION
How can i fade a color (imagecolor) gui?
2 answers
TweenService is what you need.
And since I'm in a good mood, I'll break down an example.
-- Assumes that the script is a localscript and is in the GuiButton
local TweenService = game:GetService("TweenService") -- Define the TweenService service into a variable
local goal = {} -- It's best to not define the goal for every run
local info = TweenInfo.new(1) -- This sets the time to fade to one (1) second.
local tween = TweenService:Create(script.Parent, info, goal) -- Create the tween.
script.Parent.MouseButton1Click:Connect(function() -- Connect to the MouseButton1Click event of the GuiButton
script.Parent.Color = Color3.fromRGB(0, 255, 0) -- Set the color to green
tween:Play() -- Play the tween.
end) -- Tells the compiler that we are done defining the function. If you don't have this, you'll get a SyntaxError.
local TweenService = game:GetService("TweenService") local goal = {ImageColor3 = Color3.fromRGB(255, 255, 255); } local info = TweenInfo.new(1) local tween = TweenService:Create(script.Parent, info, goal) script.Parent.MouseButton1Click:Connect(function() script.Parent.ImageColor3 = Color3.fromRGB(0, 255, 0) tween:Play() end)
2 comments
0
It just turns green. it doesnt fade to white.
0
For Me It Worked, Did You Check For Errors Maybe You Used A Image Label Or Something Like That?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
TweenService or a loop. (https://developer.roblox.com/en-us/api-reference/class/TweenService)