So what I’m trying to do is make a little client script editor. Just like when you make a script and type local it turns red.
The problem is that it doesn’t work when you are currently typing, only when the textbox focus is lost, other wise it will glitch out and make a really long text in the textbox.
I know how to cahnge the textcolors while the player is not currently typing, but I only know how to change one word not a whole list of words with diffrent colors like:
local wordTable = {"local" = (1,1,1), "Instance" = (1,1,1)}
the property changed signalfrom other post didn’t work, could someone help me?
I’m assuming that by the property chabged signal, you mean a TextBox:GetPropertyChangedSignal("Text")? If that doesn’t work, try updating it after every keypress.
As for applying the colours, you can enable RichText and use HTML tags, and update the box with that text.
local colours = {
["local"] = {220, 0, 0}
}
local function update()
local words = string.split(TextBox.Text, " ")
for i, word in next, words, nil do
if not colours[word] then continue end
local colour = colours[word]
words[i] = string.format(
'<font color = "rgb(%d, %d, %d)">'..word..'</font>',
colour[1],
colour[2],
colour[3]
)
end
TextBox.Text = table.concat(words, " ")
end