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

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

Asked by
DevingDev 346 Moderation Voter
7 years ago
Edited 7 years ago

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)
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. fahmisack123 385 — 7y
0
alright, can try DevingDev 346 — 7y

1 answer

Log in to vote
2
Answered by 7 years ago

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)
0
Thanks. DevingDev 346 — 7y
0
You kinda forgot line 8 and 29, but that doesn't really matter because that's what's meant to turn white fahmisack123 385 — 7y
1
I left them on purpose because they turn white and it's not worth wasting my time. User#6546 35 — 7y
0
well, true, and also, you enhanced my knowledge in scripting as well! Thx :D starlebVerse 685 — 7y
Ad

Answer this question