if Data.SkinColor.Value == #Race.Orc.SkinColor then
RaceAccessory.SkinColor(Character, 1)
elseif Data.SkinColor.Value == #Race.Altmer.SkinColor then
RaceAccessory.SkinColor(Character, 2)
elseif Data.SkinColor.Value == #Race.Dunmer.SkinColor then
RaceAccessory.SkinColor(Character, 3)
elseif Data.SkinColor.Value == #Race.Bosmer.SkinColor then
RaceAccessory.SkinColor(Character, 4)
elseif Data.SkinColor.Value == #Race.Khajiit.SkinColor then
RaceAccessory.SkinColor(Character, 5)
elseif Data.SkinColor.Value == #Race.Argonian.SkinColor then
RaceAccessory.SkinColor(Character, 6)
elseif Data.SkinColor.Value == #Race.Vampire.SkinColor then
RaceAccessory.SkinColor(Character, 7)
end
So basically, what I’m aiming for is to change the player skincolor based on what race they are. So say they are an Orc race, so there would be 5 color options for them such as:
I’m also using Right and Left arrow key to make it so it turns there skincolor
if v.Name == "ColorRightArrow" then
if Player.CharacterData.SkinColor.Value < MaxSkinColor then
Player.CharacterData.SkinColor.Value = Player.CharacterData.SkinColor.Value + 1
end
end
if v.Name == "ColorLeftArrow" then
if Player.CharacterData.SkinColor.Value > MinSkinColor then
Player.CharacterData.SkinColor.Value = Player.CharacterData.SkinColor.Value - 1
end
end
Player.CharacterData.SkinColor:GetPropertyChangedSignal("Value"):Connect(function()
if Player.CharacterData.SkinColor.Value < MaxSkinColor then
RaceColor()
end
if Player.CharacterData.SkinColor.Value > MinSkinColor then
RaceColor()
end
end)
Actually, not really the answer I’m looking for, but thank you for trying. I have that setup here:
module.SkinColor = function(Char, Number)
if Number == RaceModule.Orc.Number then
if Char:FindFirstChild("MeshPart" .. Data.SkinColor.Value) or Char:FindFirstChild("Part" .. Data.SkinColor.Value) == nil then
for _, child in pairs(Char:GetChildren()) do
if child.ClassName == "Part" or child.ClassName == "MeshPart" and child.BrickColor ~= BrickColor.new(Data.SkinColor.Value) then
child.BrickColor = BrickColor.new(Data.SkinColor.Value)
end
if child.Name == "Orc" then
child.OutsideEar.BrickColor = BrickColor.new(Data.SkinColor.Value)
child.InsideEar.BrickColor = BrickColor.new(Data.SkinColor.Value)
end
end
end
end
Sorry if my explanation wasn’t clear enough. So my end goal is to get it to work right? Because currently, it’s not working. So each race has there own specific colors right? And I used the orc (colors) as an example.
And that max number for colors is being 5, that is why I have this:
if v.Name == "ColorRightArrow" then
if Player.CharacterData.SkinColor.Value < MaxSkinColor then
Player.CharacterData.SkinColor.Value = Player.CharacterData.SkinColor.Value + 1
end
end
if v.Name == "ColorLeftArrow" then
if Player.CharacterData.SkinColor.Value > MinSkinColor then
Player.CharacterData.SkinColor.Value = Player.CharacterData.SkinColor.Value - 1
end
end
["Orc"] = {
Name = "Ogfal",
Description = "The Ogfal also known as big green dudes.",
Number = 1,
SkinColor = {
Color3.fromRGB(104, 113, 104),
Color3.fromRGB(139, 168, 142),
Color3.fromRGB(127, 142, 100),
Color3.fromRGB(112, 129, 114),
Color3.fromRGB(120, 144, 130)
};
};
Ah, I think I see what you’re doing. You’re comparing Data.SkinColor.Value to the size of the SkinColor table, which is obviously wrong unless each SkinColor table has a different size.
You’re using the length of the skincolor table. If its the same for all of them, you’re always going to end up with the same value. You need to use whatever value you’re using to differentiate the races.
I’ve finally solved it! Here’s what I did to solve the problem.
module.SkinColor = function(Char, Number)
if Number == RaceModule.Orc.Number then
if Char:FindFirstChild("MeshPart" .. Data.SkinColor.Value) or Char:FindFirstChild("Part" .. Data.SkinColor.Value) == nil then
for _, child in pairs(Char:GetChildren()) do
if child:IsA("BasePart") and child.Color ~= RaceModule.Orc.SkinColor[Data.SkinColor.Value] then
child.Color = RaceModule.Orc.SkinColor[Data.SkinColor.Value]
end
if child.Name == "Orc" then
child.OutsideEar.Color = RaceModule.Orc.SkinColor[Data.SkinColor.Value]
child.InsideEar.Color = RaceModule.Orc.SkinColor[Data.SkinColor.Value]
end
end
end
end
end
I know this is solved, but technically you could make use of variables so you don’t have to write an elseif chain. It’ll become very hard to read. Using variables to make this much shorter is not any less efficient than the elseif chain, rather just more practical.