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

How come my GUI button wont change its text-color when clicked?

Asked by 4 years ago

So I have a button that when clicked will change its color but for some reason, it won't change how come why?

--|Script|--

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Romans.TextColor3 = "255, 255, 255"
    script.Parent.TextColor3 = "12, 53, 0"
end)

--|locations|--

The script is located in a text button called Carthaginians and Romans is a text button located in a screen GUI along with the Carthaginians button.

P.S.

Sorry for the rushed question if you don't understand just tell me what you don't understand and I'll edit it, and or tell you.

2 answers

Log in to vote
2
Answered by 4 years ago

Wrong value, that's a string, it needs a Color3 value. Consider checking output next time. Here's an example of me assigning a variable a color3 value

Note I'm on mobile.

local a=Color3.fromRGB(255,0,255)

0
Thanks for the help vincentthecat1 199 — 4y
Ad
Log in to vote
3
Answered by
Filipalla 504 Moderation Voter
4 years ago
Edited 4 years ago

TextColor3 takes in a Color3 and not a string what you want to set it to is actually

Color3.fromRGB(255, 255, 255)
-- like this
script.Parent.Parent.Romans.TextColor3 = Color3.fromRGB(255, 255, 255)

Roblox Wiki:

Color3

TextColor3

Don't forget to mark my answer as the solution if it solved your problem(Upvotes are also very much appreciated) :)

Answer this question