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

Why does it turn all of the textlabels color to white not just one of them?

So. i am making a tab system so like if you click on Tab1 or Tab2 or Tab2 then that page will open but when you click on it the button that makes so you changes to that page the text tho i want that to turn white when you click on it and turn all of the other texts up there to gray isch but i dont know why the script i have makes so all of the texts turn into white not just the one you click on. I dont know if it is any way to make the change page script much better so this is the only way i know.

Script:

local GUI = script.Parent
local Face = GUI:FindFirstChild('FaceFrame')
local Gender = GUI:FindFirstChild('Gender')
local Cuz = GUI:FindFirstChild('Customization')
local Buttons = GUI:FindFirstChild('Buttons')

GUI.Buttons.FaceButton.MouseButton1Down:connect(function()
	GUI.Buttons.Text.Face.TextColor3 = Color3.new(255, 255, 255)
	GUI.Buttons.Text.Hair.TextColor3 = Color3.new(121, 121, 121)
	GUI.Buttons.Text.Gender.TextColor3 = Color3.new(121, 121, 121)
	Gender.Visible = false
	Cuz.Visible = false
	Face.Visible = true
end)

GUI.Buttons.HairButton.MouseButton1Down:connect(function()
	GUI.Buttons.Text.Face.TextColor3 = Color3.new(121, 121, 121)
	GUI.Buttons.Text.Hair.TextColor3 = Color3.new(255, 255, 255)
	GUI.Buttons.Text.Gender.TextColor3 = Color3.new(121, 121, 121)
	Gender.Visible = false
	Cuz.Visible = true
	Face.Visible = false
end)

GUI.Buttons.CustomizeButton.MouseButton1Down:connect(function()
	GUI.Buttons.Text.Face.TextColor3 = Color3.new(121, 121, 121)
	GUI.Buttons.Text.Hair.TextColor3 = Color3.new(121, 121, 121)
	GUI.Buttons.Text.Gender.TextColor3 = Color3.new(255, 255, 255)
	Gender.Visible = true
	Cuz.Visible = false
	Face.Visible = false
end)

2 comments

0

Now that the question is answered, I'll give you a challenge. When the player's mouse hovers over the tab, make it change color.

0

alright, can try

1 answer

✓ Accepted answer

Color3.new takes numbers from 0 to 1
Color3.fromRGB on the other hand...

Fixing your code is simple. Just replace every Color3.new with Color3.fromRGB

local GUI = script.Parent
local Face = GUI:FindFirstChild('FaceFrame')
local Gender = GUI:FindFirstChild('Gender')
local Cuz = GUI:FindFirstChild('Customization')
local Buttons = GUI:FindFirstChild('Buttons')

GUI.Buttons.FaceButton.MouseButton1Down:connect(function()
    GUI.Buttons.Text.Face.TextColor3 = Color3.new(255, 255, 255)
    GUI.Buttons.Text.Hair.TextColor3 = Color3.fromRGB(121, 121, 121)
    GUI.Buttons.Text.Gender.TextColor3 = Color3.fromRGB(121, 121, 121)
    Gender.Visible = false
    Cuz.Visible = false
    Face.Visible = true
end)

GUI.Buttons.HairButton.MouseButton1Down:connect(function()
    GUI.Buttons.Text.Face.TextColor3 = Color3.fromRGB(121, 121, 121)
    GUI.Buttons.Text.Hair.TextColor3 = Color3.fromRGB(255, 255, 255)
    GUI.Buttons.Text.Gender.TextColor3 = Color3.fromRGB(121, 121, 121)
    Gender.Visible = false
    Cuz.Visible = true
    Face.Visible = false
end)

GUI.Buttons.CustomizeButton.MouseButton1Down:connect(function()
    GUI.Buttons.Text.Face.TextColor3 = Color3.fromRGB(121, 121, 121)
    GUI.Buttons.Text.Hair.TextColor3 = Color3.fromRGB(121, 121, 121)
    GUI.Buttons.Text.Gender.TextColor3 = Color3.new(255, 255, 255)
    Gender.Visible = true
    Cuz.Visible = false
    Face.Visible = false
end)

4 comments

0

Thanks.

0

You kinda forgot line 8 and 29, but that doesn't really matter because that's what's meant to turn white

1

I left them on purpose because they turn white and it's not worth wasting my time.

0

well, true, and also, you enhanced my knowledge in scripting as well! Thx :D

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