How do you choose an item from a table based on number

im trying to get a color value based on how much hits/combo you have
idk how to get it tho
any help will be appreciated

i tried this code:


local ComboColours = 
	{
		[5] = Color3.fromRGB(66, 66, 66), -- have a combo of 5
		[10] = Color3.fromRGB(255, 154, 12),
		[15] = Color3.fromRGB(255, 0, 0),
		[25] = Color3.fromRGB(5, 180, 255),
	}


	for i, colour in pairs(ComboColours) do
		
		if ComboCount < i then
			Combo.TextColor3 = colour
		end
	end

The variable i is the hits? If you already have the value of hits then just:
Combo.TextColor3 = ComboColours[i]

But if the value of hits is not in that table, then will be no color?

the for i loop is just a random thing i slapped on there
but the code u replied with somewhat helped, it just doesnt show color for a hit amount higher than the value at the table

Lemme simplify what the code should do

If a player has a combo of 5 or above, then the text showing the combo will change color to gray

To choose an item based on its number in the table you would just type t[your number here] (t being the name of your table). However reading into what you are trying to do I would just make a variable that contains the number of hits and in the function that makes the text for the combo you would just simply check the variable with if/elseif statements. then after a certain amount of time has passed reset that combo number to zero.

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