Buggy string.gsub()

So I created a text to emoji function and its being kinda buggy.

image

local Emojis = require(script.Emojis)
local function GetEmojis(Msg)
for i, v in pairs(Emojis) do
Msg = string.gsub(Msg, i, v)
end
return Msg
end

Emojis Module:

image

Its fine for the most part, but whenever I try to convert B-), it also triggers -_- for some reason.
image
image

1 Like

This is also my first thread and Iā€™m unsure how to embed lua, sorry.

1 Like

You can embed lua using three backticks or squigglies:

Input:
```
-- code here
```

This also works:
~~~
-- code here
~~~

Output:

-- code here

So - is also a magic character I believe, so you should try replacing your indexes with B%-%) and %-_%-

2 Likes

image

2 Likes