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":
-- Variables
local Hue = script.Parent.Parent.H
local Saturation = script.Parent.Parent.S
local Value = script.Parent.Parent.V
local Color = nil
local ColorHSV = script.Parent.Parent.ColorHSV
local H = nil
local S = nil
local V = nil
local GetHSV = require(script.Parent.Parent.GetHSV)
-- Set color
while wait() do
-- Get colors
local HSV = GetHSV:GetHSV(script.Parent.Parent.H.Value, script.Parent.Parent.S.Value, script.Parent.Parent.V.Value)
-- Set colors
ColorHSV.Value = HSV
script.Parent.BackgroundColor3 = ColorHSV.Value
end
In line 10 of the local script it is getting a ModuleScript here:
local module = {}
module.GetHSV = function(Hue, Saturation, Value)
local H = 0
local S = 0
local V = 0
local N = 0
if Hue ~= 0 then
N = 359 / Hue
end
if Hue ~= 0 then
H = 1 / N
elseif Hue == 0 then
H = 0
end
if Saturation ~= 0 then
N = 255 / Saturation
end
if Saturation ~= 0 then
S = 1 / N
elseif Saturation == 0 then
S = 0
end
if Value ~= 0 then
N = 255 / Value
end
if Value ~= 0 then
V = 1 / N
elseif Value == 0 then
V = 0
end
return Color3.fromHSV(H, S, V)
end
return module
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?

1 comment
hmmm thats strange