01 | local Eye = { [ 1 ] = "Left Eye" , [ 2 ] = "Right Eye" } |
02 | local Fur = { [ 1 ] = "F-L Leg" , [ 2 ] = "F-R Leg" , [ 3 ] = "F-Left Paw" , [ 4 ] = "F-R Paw" , [ 5 ] = "B-L Leg" , [ 6 ] = "B-R Leg" , [ 7 ] = "B-L Paw" , [ 8 ] = "B-R Paw" , [ 9 ] = "Head" , [ 10 ] = "Inner Ears" , [ 11 ] = "Outer Ear L" , [ 12 ] = "Outer Ear R" , [ 13 ] = "Muzzle Bottom" , [ 14 ] = "Muzzle Top" , [ 15 ] = "Neck" , [ 16 ] = "Tail Top" , [ 17 ] = "Tail Bottom" } |
03 | local Nose = { [ 1 ] = "Nose" } |
04 | script.Parent.Target.Changed:connect( function () |
05 | if script.Parent.Target.Value = = Eye [ 1 ] or Eye [ 2 ] then |
06 | script.Parent.EyeColors.Visible = true |
07 | script.Parent.FurColors.Visible = false |
08 | script.Parent.NoseColors.Visible = false |
09 | print (script.Parent.EyeColors.Name) |
10 | elseif script.Parent.Target.Value = = Fur [ 1 ] or Fur [ 2 ] or Fur [ 3 ] or Fur [ 4 ] or Fur [ 5 ] or Fur [ 6 ] or Fur [ 7 ] or Fur [ 8 ] or Fur [ 9 ] or Fur [ 10 ] or Fur [ 11 ] or Fur [ 12 ] or Fur [ 13 ] or Fur [ 14 ] or Fur [ 15 ] or Fur [ 16 ] or Fur [ 17 ] then |
11 | script.Parent.FurColor.Visible = true |
12 | script.Parent.EyeColors.Visible = false |
13 | script.Parent.NoseColors.Visible = false |
14 | print (script.Parent.FurColors.Name) |
15 | elseif script.Parent.Target.Value = = Nose [ 1 ] then |
I didn't read through everything, but this line is definitely a problem...
1 | elseif script.Parent.Target.Value = = Fur [ 1 ] or Fur [ 2 ] or Fur [ 3 ] or Fur [ 4 ] or Fur [ 5 ] or Fur [ 6 ] or Fur [ 7 ] or Fur [ 8 ] or Fur [ 9 ] or Fur [ 10 ] or Fur [ 11 ] or Fur [ 12 ] or Fur [ 13 ] or Fur [ 14 ] or Fur [ 15 ] or Fur [ 16 ] or Fur [ 17 ] then |
Alright, first of all, EW!
Second of all, it won't work. or
separates two different, unique conditions, so you have to state two unique conditions. You have this problem on line 5 as well.
1 | elseif script.Parent.Target.Value = = Fur [ 1 ] or script.Parent.Target.Value = = Fur [ 2 ] |
But don't do this, because it will make the code even more OCD-murdering. You have two options to clean this up.
First is we use a for loop to go through the entire table and see if we have a match. It would be best to put it in a function.
1 | function check(table, lookFor) |
2 | for i, v in pairs (table) do |
3 | if lookFor = = v then |
4 | return true |
5 | end |
6 | end |
7 | end |
Your second options is to use a dictionary, making the value true
and the key whatever you want.
1 | local dictionary = { [ "a" ] = true , [ "b" ] = true } |
2 |
3 | if dictionary [ "a" ] then --since dictionary["a"] equals true, the condition will pass |