Color3 returning nil?

Im trying to just use CollectionService to get parts,beams,trails,etc to color them rainbow.

somehow when im using Color3.fromHSV() it’s erroring saying “attempt to call a nil value”

Code:

local ColorSequence = {"Beam", "Trail"}
local Color3 = {"Part", "MeshPart", "PointLight", "SurfaceLight", "SpotLight"}

local x = 0

while true do 
	for index, tagged in game:GetService("CollectionService"):GetTagged("Rainbow") do
		if table.find(Color3, tagged.ClassName) then
			tagged.Color = Color3.fromHSV(x,1,1) -- error happens here
		elseif table.find(ColorSequence, tagged.ClassName) then
			tagged.Color = ColorSequence.new{ 
				ColorSequenceKeypoint.new(0, Color3.fromHSV(x,1,1)),
				ColorSequenceKeypoint.new(1, Color3.fromHSV(x,1,1))
			}
		end
	end
	x = x + .5/255
	if x >= 1 then
		x = 0
	end
	task.wait()
end

I’ve printed out
tagged,
tagged.Color,
Color3.fromHSV(x,1,1)

I’ve even just printed Color3.fromHSV(x,1,1) in the console and it doesnt error so im lost

You cant give a variable a name that is already a core function of the language. Color3 and ColorSequence are already reserved words, give your variables different names that arent reserved, just as C3 or CS

1 Like

Oh my lord
right forgot bout that, gracias!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.