I want to make it so that when the player hovers on the TextButton the stroke changes color smoothly and when I hover out of it, it changes to the default stroke color, like this:
This is what my explorer looks like:
I want to make it so that when the player hovers on the TextButton the stroke changes color smoothly and when I hover out of it, it changes to the default stroke color, like this:
This is what my explorer looks like:
Just use TweenService, here is a code example
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
0.5, -- Time it takes to make the animation
Enum.EasingStyle.Quad, -- I use Quad because I like it, use any other
Enum.EasingDirection.Out
)
local Button = script.Parent
local UiStroke = Button.UIStroke
Button.MouseEnter:Connect(function()
TweenService:Create(UiStroke, Info, {Color = Color3.fromRGB(255, 85, 0)}):Play() -- change the color to whatever you want
end)
Button.MouseLeave:Connect(function()
TweenService:Create(UiStroke, Info, {Color = Color3.fromRGB(255, 255, 255)}):Play() -- change the color to the normal color you put
end)
Hope It helps
You can use TweenService for this
As an example:
local oldColor = DeployButton.UIStroke.Color
local ts = game:GetService('TweenService')
local Tinfo = TweenInfo.new(time in seconds, Enum.EasingStyle.Linear)
local tween = ts:Create(something something .DeployButton.UIStroke, Tinfo, {Color = Color3.new(your color)}) -- sets new clr
local returntween = ts:Create(something something .DeployButton.UIStroke, Tinfo, {Color = Color3.new(oldColor)}) -- returns to old clr
DeployButton.MouseEnter:Connect(function()
tween:Play()
end)
DeployButton.MouseLeave:Connect(function()
returntween:Play()
end)
Thanks, it works just as I wanted it to!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.