Hello guys. I worked on a profile UI, so I want to change the HUE property of color with a script.

What am I talking about? Example

--< Tables
local LevelColor = {
	[1] = Color3.fromRGB(129, 205, 246),
	[2] = Color3.fromRGB(129, 205, 246),
	[3] = Color3.fromRGB(129, 188, 246),
	[4] = Color3.fromRGB(129, 209, 246),
	[5] = Color3.fromRGB(129, 231, 246),
	[6] = Color3.fromRGB(129, 246, 241),
	[7] = Color3.fromRGB(129, 246, 221),
	[8] = Color3.fromRGB(129, 246, 202),
	[9] = Color3.fromRGB(129, 246, 182),
	[10] = Color3.fromRGB(129, 246, 162),
	[11] = Color3.fromRGB(129, 246, 141),
	[12] = Color3.fromRGB(137, 246, 129),
	[13] = Color3.fromRGB(157, 246, 129),
	[14] = Color3.fromRGB(176, 246, 129),
	[15] = Color3.fromRGB(198, 246, 129),
	[16] = Color3.fromRGB(219, 246, 129),
	[17] = Color3.fromRGB(241, 246, 129),
	[18] = Color3.fromRGB(246, 231, 129),
	[19] = Color3.fromRGB(246, 211, 129),
	[20] = Color3.fromRGB(246, 192, 129),}

--< Variables
local function FoundNumberColor(Number)
	if Number > 20 then
		local NewNumber = math.abs(20 - (Number - 20))
		if NewNumber == 0 then
			NewNumber = 1
		elseif NewNumber == 20 then
			NewNumber = FoundNumberColor(Number)
		end
		return NewNumber
	else
		return Number
	end
end

--< Events
function Module:SetGameSession(Session)
	local ProfileGui = PlayerGui:WaitForChild('ProfileGui')
	local Menu = ProfileGui.Menu.FProfile
	-- Set color3
	local Color = FoundNumberColor(Session['Level'])
	Menu.LevelText.TextColor3 = LevelColor[Color]
	Menu.Stats.Level.TextColor3 = LevelColor[Color]
	Menu.Stats.BackBar.Bar.ImageColor3 = LevelColor[Color]
end

9 comments

0

do you mean like: thing.Color = Color3.fromRGB(200,thing.Color.g,thing.Color.b) that leaves the G and B components unchanged

1

Color3.fromHSV

0

ya just use HSV

0

How implic that on my script? I don't understand how to use FromHSV and keeping my basic set color.

0

its hue, saturation and value

0

I know it's what I'm looking for but it does not work properly, When I try to change the HUE value, it change all and set the color on black (-67238, -62803, -67823)

0

I'm pretty sure fromHSV takes values 0-1 so yoou'd have to do x/255