I was trying to make a custom chat and this error came when i tried to send a message in it : 18:41:05.353 - Players.m6xw.PlayerGui.Chat.LocalScript:16: attempt to concatenate Instance with string
code :
local TextBox = script.Parent.ChatFrame.SendFrame.SendBox
local Holder = script.Parent.ChatFrame.Holder
local Event = game.ReplicatedStorage.RemoteEvent
local Template = game.ReplicatedStorage.Template
TextBox.FocusLost:Connect(function(ep)
if (ep) and TextBox.Text ~= "" then
Event:FireServer(TextBox.Text)
else
warn("Please put text.")
end
end)
Event.OnClientEvent:Connect(function(Message, Author)
local Clone = Template:Clone()
Clone.Player.Text = "[" .. Author .. "]:"
Clone.MessageLabel.Text = Message
Clone.Parent = script.Parent.ChatFrame.Holder
end)
another code :
local Event = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(Player, Message)
if Message ~= "" then
Event:FireAllClients(Message, Player)
end
end)

1 comment
accept the answer if it helped