Is there anyway to allow emojis to be typed using a text box in-game while not censoring it? I don’t know if there is a function to allow this or if its a text box property. I’ve tried looking in the developer api page but only found nothing.
I have good and bad news, its possible but with specific methods, you would have to write the entire word instead of an emoji (if you are on a phone).
The data I found is in the API of TextBox.Text and if you dont want the whole text to change you can use “string.upper” [If there is another method idk it]
LocalScript inside TextBox
local TextBox = script.Parent
local moods = {
["happy"] = "😃";
["sad"] = "😢";
["neutral"] = "😐";
["tired"] = "😫";
}
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
for mood, face in pairs(moods) do
if TextBox.Text == mood then
TextBox.Text = face
end
end
end)
Well i’ve seen a game do this before, like theme park tycoon 2. I was wondering how the developers did that aswell.
What do you mean the text box censors it? Can you elaborate on use-cases and a way to reproduce the censoring?
Basically if you put an emoji in a textbox while studio isn’t running, the emoji doesn’t turn to a square. If you run studio and input a emoji into the textbox, the emoji will be replaced by a square.
Can’t replicate this, what emojis are you trying?
Really any emoji for me doesn’t work, like slight smile
Can you get a screenshot of it so I can see what you’re talking about?
The box is suppose to be a but it got replaced by this box.
How are you inputting them / what platform are you on?
Im on windows and im using this website https://getemoji.com/
It shouldn’t really matter as it works when studio isn’t running.
Try using [windows key + “.”] to open the built-in emoji menu?
It just gets replaced by the box after I press enter.
I wrote a bit of python code to extract all known emojis into a Roblox dictionary. The module used in the code snippet can be found here:
--After inserting the module into the game, name it Emojis and parent inside the script
local Emojis = require(script.Emojis)
local TextBox = script.Parent
--ignore magic characters
function SanitizeText(text)
return text:gsub("([%%%^%$%(%)%.%[%]%*%+%-%?])", "%%%1")
end
--code
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
local text = TextBox.Text
local words = string.split(text, ":")
for word = 2, #words-1, 2 do
local current = words[word]
local emoji = Emojis[current:lower()]
if emoji then
text = text:gsub(":"..SanitizeText(current)..":", emoji)
end
end
TextBox.Text = text
--fixes a bug where emojis split into half when space is pressed
TextBox.CursorPosition += 1
end)
So will this convert my emojis or will it convert text into emojis?
Also found out your from the future
Basically when a user types an emoji into the textbox like this: :thumbs_up:
it will be converted into the emoji.
It doesn’t seem to be converting it at all, just leaving it as raw text.
TextBox
must be a reference to the TextBox the user types, and the module I provided must be parented inside the script and named Emojis
. Also to show the emojis you must surround them with :
like this: :taco:
Here is an example that can be parented in StarterGui
: Text to Emoji - Roblox
Yes, i’ve done all of that, it just doesn’t convert. Even if it did the box will still replace the emoji.