Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

button text color 3 not chaching back to its orginal value?

sorry im on mobile now cause my internet on pc fell off so sorry For bad formatting

so i have this script if some ones enters my button with their mouse the background color chanches but it doesnt change back why

script.Parent.MouseButton1Click:Connect(function()

script.Parent.Text = "You Clicked Me"

end)

script.Parent.MouseEnter:Connect(function()

script.Parent.BackgroundColor3 = Color3.new(58, 58, 58)

end)

script.Parent.MouseLeave:Connect(function()

script.Parent.BackgroundColor3 = Color3.new(120, 120, 120)

end)

2 answers

✓ Accepted answer

Hello Hokyboy! There are a couple things I see that could be the cause for your problems. The main one, is you using Color3.new(). This is one of the things I see most often and is always confused with Color3.fromRGB(). The values you provided look like red green blues, so try replacing the .new() with .fromRGB(). When you do use color3.new(), it accepts values from 0-1 for R,G,B. When you you use fromRGB(), it takes numbers from 0-225. I hope this helped. If you need further assistance or have any questions/comments/concerns, please reply to my post. ~mc3334

It's better to use Color3.fromRGB(number x, number y, number z). It accept values from 0 - 255. For example, if you were using Color3.fromRGB(), then it goes like this.

script.Parent.BackgroundColor3 = Color3.fromRGB(0,0,0) 
--This would be Black.

script.Parent.BackgroundColor3 = Color3.fromRGB(0,255,0) 
--This would be Lime Green.

script.Parent.BackgroundColor3 = Color3.fromRGB(100,100,100) 
--This would be Greyish.

This discussion is preserved as it was. New answers, comments, and votes are closed.