Hello! I am currently working on a game where I need text to be set through a script, with a special character. I am using the code below to add text to a table of tables {{{char: string, textColor: Color3?, bgColor: Color3?}}}
although when using special characters such as “█” it gets converted into “�”. I tried messing around with utf8 and nothing really seemed to work. Any help is appreciated, here is the code I used below:
function module.AddText(text: string, cur_pos: Vector2)
if not chars[cur_pos.Y + 1] then
chars[cur_pos.Y + 1] = {}
end
local row = chars[cur_pos.Y + 1]
for i = #row + 1, cur_pos.X do
row[i] = { char = "" }
end
local i = 0
for c in text:gmatch(".") do
i += 1
row[cur_pos.X + i] = {
char = c,
textColor = curr_color,
bgColor = curr_bg_color
}
end
module.UpdateTextLabels()
end
module.AddText("RoTerminal [Version 2.0.0]", Vector2.new(0, 0))
module.AddText("(c) Indium. All rights reserved.", Vector2.new(0, 1))
module.SetTextColor(Color3.fromRGB(143, 143, 143))
module.SetBackgroundColor(Color3.fromRGB(255, 135, 135))
module.AddText("█ █", Vector2.new(0, 2))
module.AddText("█ █", Vector2.new(0, 4))
module.AddText(" █████ ", Vector2.new(0, 5))
-- should draw smiley face, instead draws a mess of weird characters
Please note that this isn’t an issue with the font, I can manually add to the textbox, but when I use the .AddText method it shows the question mark.