Error in compiler complaining about nonexistent concatentation

  1. What do you want to achieve? Keep it simple and clear!
    I have a microphone block, I use lua mic.Chatted:Connect(function(player, voice) to get the playerid and text output. The microphone should only respond to messages that begin with V:, which i ensure by using lua local chat = voice:match(".+ | v:[%s]?(%d+)").

  2. What is the issue? Include screenshots / videos if possible!
    The microphone responds to every message that is sent despite voice:match being used. The code also complains about a concat nil error line on 114, but line 114 does not exist in my script.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    No, i did not go looking for solutions on the developer hub as I can’t find specific things related to my problem. Roblox assistant has not been helpful at all and keeps hallucinating.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local Keyboard = GetPart("Keyboard")
local KeyboardIDCHANGER = GetPart("Keyboard")
local speak = GetPart("Speaker")
local modem = GetPart("Modem")
local Screen = assert(GetPart("Screen"),"Screen appears to be missing.")
local mic = GetPart("Microphone")
	Screen:ClearElements()

num = 0


--Messages sent out are compatible with Arvid's Chat Modem Uses the `{Name} | {Message}` format, ID 2 is standard.

local Frame = Screen:CreateElement("Frame",{Size = UDim2.fromScale(1,1),AnchorPoint = Vector2.new(0.5,0.5),Position = UDim2.fromScale(0.5,0.5);BackgroundColor3 = Color3.new(0.792157, 1, 1),BackgroundTransparency = 0,})
local IDLabel:ImageLabel = Screen:CreateElement("ImageLabel",{Size = UDim2.fromScale(0.35,0.14),AnchorPoint = Vector2.new(0,0),Position = UDim2.fromScale(0.025,0.025);BackgroundColor3 = Color3.new(1, 1, 1),BackgroundTransparency = 0,Image = "rbxassetid://108167164039020";})
local Chats:ScrollingFrame = Screen:CreateElement("ScrollingFrame",{Size = UDim2.fromScale(0.6,0.93),AnchorPoint = Vector2.new(0.5,0.5),Position = UDim2.fromScale(0.69,0.5);BackgroundColor3 = Color3.new(0.204685, 0.204685, 0.204685),BackgroundTransparency = 0,Rotation = 0;CanvasSize = UDim2.fromScale(0.5,1);AutomaticCanvasSize = Enum.AutomaticSize.Y;})

local frame = Screen:CreateElement("Frame", {BackgroundColor3 = Color3.fromHex("#3F3F3F"), BorderColor3 = Color3.fromHex("#000000"), BorderSizePixel = 0, Position = UDim2.fromScale(0.05, 0.23), Size = UDim2.fromScale(0.17, 0.69) })
local imageLabel = Screen:CreateElement("ImageLabel", { Image = "http://www.roblox.com/asset/?id=4584251621", BackgroundColor3 = Color3.fromHex("#FFFFFF"), BorderColor3 = Color3.fromHex("#000000"), BorderSizePixel = 0, Size = UDim2.fromScale(1, 0.9) })
local power = Screen:CreateElement("ImageLabel", { Image = "http://www.roblox.com/asset/?id=1145367640", ImageColor3 = Color3.fromHex("#00FF00"), ScaleType = Enum.ScaleType.Slice, SliceScale = -0.05, AnchorPoint = Vector2.new(1, 1), BackgroundColor3 = Color3.fromHex("#FFFFFF"), BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(1, -5, 1, -5), Size = UDim2.fromScale(0.15, 0.15), SizeConstraint = Enum.SizeConstraint.RelativeXX })
local recieve = Screen:CreateElement("ImageLabel", { Image = "http://www.roblox.com/asset/?id=1145367640", ImageColor3 = Color3.fromHex("#000000"), ScaleType = Enum.ScaleType.Slice, SliceScale = -0.05, AnchorPoint = Vector2.new(1, 1), BackgroundColor3 = Color3.fromHex("#FFFFFF"), BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(1, -35, 1, -5), Size = UDim2.fromScale(0.15, 0.15), SizeConstraint = Enum.SizeConstraint.RelativeXX })
local status = Screen:CreateElement("ImageLabel", { Image = "http://www.roblox.com/asset/?id=1145367640", ImageColor3 = Color3.fromHex("#000000"), ScaleType = Enum.ScaleType.Slice, SliceScale = -0.05, AnchorPoint = Vector2.new(1, 1), BackgroundColor3 = Color3.fromHex("#FFFFFF"), BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(1, -20, 1, -5), Size = UDim2.fromScale(0.15, 0.15), SizeConstraint = Enum.SizeConstraint.RelativeXX })

imageLabel.Parent = frame
power.Parent = frame
recieve.Parent = frame
status.Parent = frame


local Elements = {}

function AddTextbox(msg)
	num += 1

	local size = 0.25

	local Args = string.split(msg," | ")

	if Args[2] == nil then
		Args = {
			"Unknown Device";
			msg
		}
	end

	Elements[num] = Screen:CreateElement("Frame", {Size = UDim2.fromScale(0.85,size),AnchorPoint = Vector2.new(0.5,0.5),Position = UDim2.fromScale(0.5,-size/2);BackgroundColor3 = Color3.new(1, 1, 1),BackgroundTransparency = 0;Rotation = 0;})

	local text = Screen:CreateElement("TextLabel", { Text = Args[2], TextColor3 = Color3.new(0,0,0), TextScaled = true, TextSize = 14, TextWrapped = true, TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Top, BackgroundColor3 = Color3.fromHex("#FFFFFF"), BorderColor3 = Color3.fromHex("#000000"), BorderSizePixel = 0, Position = UDim2.fromScale(0, 0.2), Size = UDim2.fromScale(1, 0.8) })
	local name = Screen:CreateElement("TextLabel", { Text = Args[1], TextColor3 = Color3.new(0,0,0), TextScaled = true, TextSize = 27, TextWrapped = true, BackgroundColor3 = Color3.fromHex("#2F2F2F"), BorderColor3 = Color3.fromHex("#000000"), BorderSizePixel = 0, Position = UDim2.fromScale(0.01, 0.01), Size = UDim2.fromScale(0.48, 0.19) })

	function CHANGECOLOR()
		local index = 0;
		while task.wait() do
			local color = Color3.fromHSV((index % 356) / 355, 1, 1)
			name.BackgroundColor3 = color
			index += .5
		end
	end 

	task.spawn(CHANGECOLOR)		

	text.Parent = Elements[num]
	name.Parent = Elements[num]

	for _, Element:TextLabel in Elements do
		Element.Position = UDim2.fromScale(0.5,Element.Position.Height.Scale + size)
	end
	Elements[num].Parent = Chats
end

KeyboardIDCHANGER.TextInputted:Connect(function(msg,Player)
	local text = `{Player} | {msg:sub(1,-2)}`
	modem:SendMessage(text, modemID)

	Beep(0.6)

	status.ImageColor3 = Color3.fromHex("#FF8000")
	wait(0.2)
	status.ImageColor3 = Color3.fromHex("#000000")
end)

modem.MessageSent:Connect(function(msg)
	Beep(0.7)
	if type(msg) == "table" then
		local stringTable = {}
		for index, value in msg do
			table.insert(stringTable, tostring(value))
		end
		msg = table.concat(stringTable, ", ")
	end
	print(msg)
	speak:Chat(msg)
	AddTextbox(msg)

	recieve.ImageColor3 = Color3.fromHex("#007BFF")
	wait(0.2)
	recieve.ImageColor3 = Color3.fromHex("#000000")
end)

mic.Chatted:Connect(function(player, voice)
	local chat = voice:match(".+ | v:[%s]?(%d+)")
	local text1 = `{player} | {chat}`
	modem:SendMessage(text1, modemID)
end)





Why do you have .+ (Note the space) in your match regex?

why is the space bad and what is a regex,
anyways i solved the problem so this issue is closed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.