Hello,
I have a script here that makes it so the textbutton’s color changes when you hover over it, and goes back to normal once its not being hovered. However, it does not go back to the grey color that it usually is, 141, 141, 141. Here is the script:
tb.MouseEnter:Connect(function()
tb.TextColor3 = Color3.new(255, 255, 255)
end)
tb.MouseLeave:Connect(function()
tb.TextColor3 = Color3.new(144, 144, 144)
end)
No errors in output. If anyone has any ideas, please tell me!
What’s wrong, the color is the incorrect color?
Yeah, it’s staying the same white color even though the value is 144, 144, 144 but it stays 255, 255, 255.
Proville6
(Proville6)
April 8, 2022, 2:47pm
4
You need to use Color3.fromRGB because thats a RGB value.
You need to use fromRGB
tb.MouseEnter:Connect(function()
tb.TextColor3 = Color3.fromRGB(colorcode)
end)
tb.MouseLeave:Connect(function()
tb.TextColor3 = Color3.fromRGB(colorcode)
end)
Valkyrop
(aHuman)
April 8, 2022, 2:48pm
6
Try
tb.MouseEnter:Connect(function()
tb.TextColor3 = Color3.fromRGB(255,255,255)
end)
tb.MouseLeave:Connect(function()
tb.TextColor3 = Color3.fromRGB(144,144,144)
end)
Alright thanks a lot, this helped a bunch. Thanks to you too @Proville6 and @Valkyrop
Valkyrop
(aHuman)
April 8, 2022, 2:49pm
8
Using “.new” is mainly used with BrickColor [in terms of colors]
e.g:
Part.BrickColor = BrickColor.new("White")
You could of course player with both, and convert Color3 to BrickColor, and vice versa.
Yeah, I was reading the api for text color and they used .new so I assumed that was the base value.
1 Like
Nogalo
(Nogalo)
April 8, 2022, 2:51pm
10
when using Color3.new() you must choose numbers between 0 and 1, so .new(1,0.2,.7)
script.Parent.MouseEnter:Connect(function()
script.Parent.TextColor3 = Color3.new(0, 0.0666667, 1)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.TextColor3 = Color3.new(1, 0, 0.0156863)
end)
Oh, so it’s possible to do this with both .new and .fromRGB. That’s good to know.
Nogalo
(Nogalo)
April 8, 2022, 2:54pm
12
when you write Color3.new( your editor should show you a little menu to open up the color picker and choose like that instead of using numbers, if it doesn’t right away click inside the ( ) and it should open like in the image above
Alright thank you a bunch man!
Valkyrop
(aHuman)
April 8, 2022, 2:58pm
14
Yes, there are actually alot of ways to change a TextColor
Never new that. I thought there was only brickcolor, .new, and .fromRGB.