Code that runs on the client in every player.
wait(.1)
local thing = script.Parent.Parent.ChatFrame.ChatRenderFrame
local name
local msg
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
--print(script.Parent.RemoteEvent.Name)
thing.ChildAdded:Connect(function(child)
if string.find(child.Name, "message") then
wait(0.1)
local split = string.split(child.Name," - ")
name = thing:FindFirstChild(split[1])
msg = child.Text
local box = child:Clone() --anything from here to senderp you can delete
box.Parent = child
box.Position = UDim2.new(-0.01,0,0,0)
box.Text = name.Text..trim(msg)
box.TextXAlignment = Enum.TextXAlignment.Left
box.TextYAlignment = Enum.TextYAlignment.Top
box.Size = UDim2.new(0,box.TextBounds.X + 24,0,box.TextBounds.Y + 1)
box.Name = name.Text..trim(msg)
box.TextTransparency = 1
box.ZIndex = -1
box.BackgroundTransparency = 0.3
print(thing:FindFirstChild(split[1]))
local senderp = game.Players:FindFirstChild(game.Players.LocalPlayer.Name) -- you can remove everything above this if its not 2012
print(senderp)
if senderp then
print("SENDERP")
if senderp.Character then
if senderp.Character:FindFirstChild("Head") then
local texttosend = string.split(name.Text..trim(msg),";")
print(senderp,texttosend[2])
wait(0)
game.ReplicatedStorage.OB_Events.OB_ChatBubble:FireServer(senderp,texttosend[2])
end
end
end
end
end)
Code on the server.
wait(.1)
local thing = script.Parent.Parent.ChatFrame.ChatRenderFrame
local name
local msg
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
--print(script.Parent.RemoteEvent.Name)
thing.ChildAdded:Connect(function(child)
if string.find(child.Name, "message") then
wait(0.1)
local split = string.split(child.Name," - ")
name = thing:FindFirstChild(split[1])
msg = child.Text
local box = child:Clone() --anything from here to senderp you can delete
box.Parent = child
box.Position = UDim2.new(-0.01,0,0,0)
box.Text = name.Text..trim(msg)
box.TextXAlignment = Enum.TextXAlignment.Left
box.TextYAlignment = Enum.TextYAlignment.Top
box.Size = UDim2.new(0,box.TextBounds.X + 24,0,box.TextBounds.Y + 1)
box.Name = name.Text..trim(msg)
box.TextTransparency = 1
box.ZIndex = -1
box.BackgroundTransparency = 0.3
print(thing:FindFirstChild(split[1]))
local senderp = game.Players:FindFirstChild(game.Players.LocalPlayer.Name) -- you can remove everything above this if its not 2012
print(senderp)
if senderp then
print("SENDERP")
if senderp.Character then
if senderp.Character:FindFirstChild("Head") then
local texttosend = string.split(name.Text..trim(msg),";")
print(senderp,texttosend[2])
wait(0)
game.ReplicatedStorage.OB_Events.OB_ChatBubble:FireServer(senderp,texttosend[2])
end
end
end
end
end)