Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

attempt to concatenate Instance with string???

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 answer

✓ Accepted answer

You might wanna do Author.Name. Since Author is an instance and not a string, it'll error.

1 comment

0

accept the answer if it helped

This discussion is preserved as it was. New answers, comments, and votes are closed.