How do I reference a Color3 value type in scripts?

I’m trying to write a script that colors an object using a color3 value that a user selects using in game chat or a clickable button, but the script errors if the player presses the button due to the script expecting a string value instead of a Color3. I’ve tried to look for a solution using the Lua type() function thingy, but because Color3 is a unique value type to Roblox, the script ignores it. Additionally, I tried looking on the API Reference Manual but nothing about custom value types pops up.

Is there a way to reference custom value types or do I need to change my script entirely?

Example of what my script looks like:

	if type(color) == 'Color3' then --this is ignored by the script
		print('lol')
	end

	local suslol = string.split(color, ',') --this results in an error if color is a Color3 value
	if table.getn(suslol) ~= 3 then
		return false, 'RBG value needed! (example: 0,0,0)'
	end
1 Like

The global function typeof() includes engine-specific types.

1 Like

Otherwise referred to as userdata types.