Hello, I am trying to make it that after you type in a certain keyword in a textbox, that keyword turns a different color than the rest of the text.
How would I do this?
Hello, I am trying to make it that after you type in a certain keyword in a textbox, that keyword turns a different color than the rest of the text.
How would I do this?
So basically I would get where the keyword starts, add the beginning html there, then add the ending html where it ends?
Yeah, that should work. Let me know if you have any issues.
But what im currently trying to figure out is how to remove the html from that position when part of the keyword is deleted
You could save the text as a variable and whenever they change the content of the textbox you could set the text back to the original text and add the html
local frame = script.Parent
local label = frame:WaitForChild("TextLabel")
local box = frame:WaitForChild("TextBox")
local text = "the quick brown fox jumps over the lazy dog."
label.Text = text
box:GetPropertyChangedSignal("Text"):Connect(function()
label.Text = text
local term = box.Text
if term ~= "" then
local split = text:split(term)
if #split - 1 > 0 then
label.Text = table.concat(split, "<font color=\"#00ff00\">"..term.."</font>")
end
end
end)
I tried doing it myself, and this seemed to work. Good luck!
Thanks so much! I’m making a script editor so that people can learn Lua and I want it to function the same way as a normal script editor would. This helps a lot!
Sorry to bump a solved topic, but… This completely freezes Roblox Studio. Am i doing something wrong?