local textcolor = script.Parent.SurfaceGui.TextButton.TextColor3
local click = script.Parent.ClickDetector
local red = Color3.fromRGB(255, 0, 0)
click.MouseClick:Connect(function()
textcolor = red
end)
The code is housed inside a normal script.
For some reason, it is not working. No errors are showing up in output. What I would like it to do is for the part to make the textcolor of the text label (named text button) turn red.
No, button returns (script.Parent.SurfaceGui.TextButton) in the workspace, using a variable like : button.TextColor3 = red
will be translated to script.Parent.SurfaceGui.TextButton.TextColor3 = red
It doesn’t change the variable’s textcolor… (why would it?)
It changes script.Parent.SurfaceGui.TextButton since button is assigned as script.Parent.SurfaceGui.TextButton,
If you try doing: print(button)
It’ll return: script.Parent.SurfaceGui.TextButton
Calling the variable’s name, returns what’s assigned to the variable.
button is a variable I created, so I’m still not sure what you’re trying to inform me about.
button is the TextButton, a variable I created. By changing button.TextColor3, you are changing the actual TextColor3 as intended. textcolor is (for anyone else reading this) a copy of TextColor3. By changing the variable textcolor, you are only changing the variable and not the actual TextColor3