There are 3 IntValues
and they represent an H, S or V value (as in hue, saturation and value). Hue's value is in a number range of 0 to 359 and saturation and value's are in a number range on 0 to 255.
I have a LocalScript
inside a Frame
called "Color":
02 | local Hue = script.Parent.Parent.H |
03 | local Saturation = script.Parent.Parent.S |
04 | local Value = script.Parent.Parent.V |
06 | local ColorHSV = script.Parent.Parent.ColorHSV |
10 | local GetHSV = require(script.Parent.Parent.GetHSV) |
16 | local HSV = GetHSV:GetHSV(script.Parent.Parent.H.Value, script.Parent.Parent.S.Value, script.Parent.Parent.V.Value) |
20 | script.Parent.BackgroundColor 3 = ColorHSV.Value |
In line 10 of the local script it is getting a ModuleScript
here:
03 | module.GetHSV = function (Hue, Saturation, Value) |
20 | if Saturation ~ = 0 then |
24 | if Saturation ~ = 0 then |
26 | elseif Saturation = = 0 then |
36 | elseif Value = = 0 then |
40 | return Color 3. fromHSV(H, S, V) |
If you've worked with HSV before, you would know that in:
Color3.fromHSV(H, S, V)
H, S and V have to be in a number range of 0 to 1 like:
Color3.new(R, G, B)
Unlike:
Color3.fromRGB(R, G, B)
Which has to be from 0 to 255.
What the module does is it converts the 3 H, S and V IntValues
into:
Color3.fromHSV(H, S, V)
The problem is that when I call the GetHSV(Hue, Saturation, Value) function from line 11:
N = 359 / Hue
It prints (in the output):
12:06:08.288 - ModuleScript:11: attempt to perform arithmetic (div) on number and table
In the output, by "div" it means divide, in case you didn't know already.
As the output says, Hue is a table, when it is clearly not, as in line 16 of the LocalScript
it is being called from, Hue is put as, "script.Parent.Parent.H.Value", and H.Value is an IntValue, not a table.
Help?