Search bar highlight effect?

sup

i’d rather just show what i’m trying to achieve:


(notice how the highlighting readjusts itself in relation to the input)

no issue really, just trying to figure out how to go about doing this.

i tried thinking of some string methods like string.sub() to get part of the string and colour it, before putting it back with the original string or smth like that.

(don’t show me the answer, but give me ideas on how i could do this)

help is much appreciated, thank you.

Try using string.split to check each letters

local split = string.split("same", "")
split[1] -- "s"
split[2] -- "a"
split[3] -- "m"
split[4] -- "e"

then check if the TextBox.text matches those splitted string in ordered index by finding the length of the text in the TextBox

1 Like

aight, i will try this method first thing in the morning. thank you.