I don’t know how I have tried a lot of solutions. My example is like
“Hello bruh”
Becomes
"Hello "
I have tried many solutions but I can’t find anything! I wanted to make this as I think it’s cool that KAT did this. I have tried many devforum posts on making them but there is non for chat, there is only ones with TextLabels and Frames which I can’t add into the chat…
it’s sort of like commands. You would do it like this:
local image = --image for bruh
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local words = msg:split(" ")
for i,v in pairs(words) do
if v == "bruh" then
table.remove(words, i)
table.insert(words, image, i)
end
end
local str = ""
for i,v in pairs(words) do
str ..= v..(i < #words and " " or "")
end
--send word to everyone
end)
end)
So it shows the landing it is on for example
“Hello I am bruh”
becomes
“Hello I am4”
and “bruh”
becomes “1”
but how would I make it insert an imagelabel there so the image can show? OR
Anyway to show the image.
No I mean like everytime you add a CERTAIN SPECIAL keyword then it adds a imagelabel or whatever to make the image because in KAT for example if you say “bruh” it shows an image whereever you said bruh, I don’t want normal emojis.
I literally have done that! Essentially what you are gonna do is
local input = "Hello :bruh:"
local ss = "★" -- this is used a separator so that it wont remove smiles ":)"
local emojis = {
[":bruh:"] = 12392131 -- id (this one is NOT valid)
}
for i,v in pairs(emojis) do
if string.find(input,i) then
input = input:gsub(i,ss..string.gsub(i,":","")..ss
end
end
-- input would in theory be Hello ★bruh★ now lets split it!
local split = string.split(input,ss)
for i,v in pairs(split) do
local isimg = false
for i,v in pairs(emojis) do
if v == i then
isimg = true
end
end
if isimg then
-- add imagelabel
else
-- add textlabel
end
end
this is NOT tested and I am not gonna give my custom emoji script. Cuz its copy righted.
Also one thing add a frame in that text label. with a ui list layout that has sortorder = name
and then just name the images and text labels to numbers from start to finish.
I understand this but I am confused on how to add it so if I say “I am bruh how’re you bruh?”
It will show the message as
“I am [image here] how’re you [image here]?”
I don’t know how to get the offset and stuff to make it setup like that…
you making this a bit more tough. I guess ill give you my script edited ofc.
cuz it took me a LONG time to make it and am not gonna give it full.
also remember this only works for horizontal textlabel so it would only work for 1 line.
its up to you to edit it NOT MINE. and it does NOT respect screen sizes
as it uses offset
local CustomEmoji = {}
local label
local images = {["bruh"] = 12312312312312}
local num = 0
local function addlabel(text,frame)
if text ~= "" then
local line = Instance.new("TextLabel",frame)
line.Name = num
num += 1
line.Size = UDim2.fromOffset(0,label.TextSize)
line.Font = require(game.ReplicatedStorage:WaitForChild("PieChat").Config).Font
line.TextSize = label.TextSize
line.TextColor3 = label.TextColor3
line.BackgroundTransparency = 1
line.AutomaticSize = Enum.AutomaticSize.X
line.Text = text
line.RichText = true
line.TextScaled = true
end
end
local function addimg(id,frame,isgif,tab)
local img = Instance.new("ImageLabel")
img.Name = num
num += 1
img.Size = UDim2.fromOffset(label.TextSize,label.TextSize)
img.Image = "rbxassetid://"..id
img.BackgroundTransparency = 1
img.Parent = frame
end
local function update(str)
if label:FindFirstChild("Line") then label.Line:Destroy() end
num = 0
for i,v in pairs(images) do
str = str:gsub(i,"★"..i:gsub(":","").."★")
end
local split = string.split(str,"★")
local frame = Instance.new("Frame",label)
frame.Name = "Line"
frame.AutomaticSize = Enum.AutomaticSize.Y
frame.BackgroundTransparency = 1
frame.Size = UDim2.fromOffset(label.TextBounds.X,label.TextBounds.Y)
local uilistlayout = Instance.new("UIListLayout",frame)
uilistlayout.FillDirection = Enum.FillDirection.Horizontal
uilistlayout.SortOrder = Enum.SortOrder.Name
for i,v in pairs(split) do
local imgg = nil
for ii,img in pairs(images) do
if v:lower() == string.gsub(ii,":","") then
imgg = img
break
end
end
if imgg then
addimg(imgg,frame)
else
addlabel(v,frame)
end
end
end
function CustomEmoji.Update(Label,Text)
label = Label
update(Text)
end
return CustomEmoji
-- Give me credits.
the full script is copyrighted as its very advance and uses GIFS. this is acctually for a chat system I am making called Pie Chat and when it releases all my scripts will be un copy righted. (If I release it to public ofc) you can sort of test it. its still in beta. doe
Just say custom emoji made by me (kidsteve923) cuz i like credits :). Also you may think HOW TO USE IT?
I gotchu my guy
local CE = require() -- path to custom emoji module (CE = Custom Emojis)
local Label = script.Parent
local Text = "Whats up :bruh:"
CE.Update(Label,Text)