So i got this error on one of the line of my server script
Error Line: Line 39, requested by @incapaxian
Script(Look for command lines like " -- ** ") :
local Mic = script.Parent
local StringValue = Mic:WaitForChild("StringValue") -- **
local BoolValue = Mic:WaitForChild("BoolValue")
local tables = {} -- **
local sender = "" -- **
local recipient = "" -- **
BoolValue.Value = false -- ClickDetector Not Clicked
print(BoolValue.Value)
game.Players.PlayerAdded:Connect(function(player)
Mic.ClickDetector.MouseClick:Connect(function()
if BoolValue.Value == false and workspace.Radio2.Mic:WaitForChild("StringValue").Value ~= player.Name then
Mic.Sound:Play()
print("Played")
Mic.BillboardGui:WaitForChild("TextLabel1").Visible = true
StringValue.Value = player.Name -- ** <--<--<-- One Here
print("StringValue.Value = "..StringValue.Value)
BoolValue.Value = true
print(BoolValue.Value)
else
return
end
if BoolValue.Value == true then
print("Stage1")
if workspace.Radio2.Mic.StringValue.Value ~= "" then
print("Stage2")
player.Chatted:Connect(function(message) -- **
print("MessageID Is "..player.UserId)
if not player.Name then
print("Did not print what "..player.Name.." said.")
return
elseif Mic:WaitForChild("StringValue").Value == player.Name then
tables[sender] = Mic.StringValue.Value -- **
tables[recipient] = workspace.Radio2.Mic.StringValue.Value -- ** <--<--<-- One Here
print("Recipient Is "..recipient)
script.Parent.Parent.Parent.Radio2.Mic.BillboardGui.TextLabel2.Text = "["..player.Name.."]: "..message[tostring(tables[sender])] -- Error Line
print("Done")
wait(5)
script.Parent.Parent.Parent.Radio2.Mic.BillboardGui.TextLabel2.Text = ""
end
end)
else
print("Not Stage2")
BoolValue.Value = false
print(BoolValue.Value)
return
end
else
BoolValue.Value = false
print(BoolValue.Value)
return
end
end)
end)
Error: Attempt to concatenate '?' (a nil value)
Can someone explain to me why i got this error? And how can i change the error line so that i wont get the error ?
All helps will be greatly appreciated. Will accept the most suitable answer.

43 comments
"Look for command lines like --" First those aren't commands, and you have 50 lines with --
ok, first state which line is erroring, you have multiple lines in your code where you're trying to concatenate
also, click detectors have a player parameter
@theking48989987 Look for the line that says -- Error Line
We don't need to look through it ourselves, tell in the question goddamn it
@incapaxian Stupid so why are u giving downvotes? ill report ur account for anyhow giving downvotes and this is not a request, and its not against any rule, ill report u just for that idiot.
@incapaxian and those are commands, and "--" this is command stuff to it so that those who were trying to help can see the main point better unlike u anyhow giving downvotes
I'm downvoting because it is a bad question, and you're refusing to make it easier for us to see the line of error, all you say is to look for a line -- Error Line, when you can just say in the question where, like "The error occurs on line X".
thats called two dashes and it is also a comment
Makes it way easier and -- is for single line comments, not a command whatsoever
@incapaxian How is it a bad qn? i bet u dont even know what causes that error. And what do u mean just say in the question? I can also say it using commands right? Whats the problem?
I can remove my downvote if the question is more descriptive
Commands is the improper terminology
its comments, not commands, those are very different things
@incapaxian scroll down theres more lol. And i dont even understand what is causing the error so how am i gonna make it more descriptive
I never said that at all. I meant you should put in your question where the error is, not just tell us to read 61 lines of messy code only to find the line that is commented "Error Here". We don't need to be doing the searching at all
@theking48949987 oo lol im confused with the other programming language
@incapaxian Ok so? Find ONE post and send me the link and show me if anybody actually did that. I didnt see before, also i didnt use scriptinghelpers alot, how the heck am i suppose to know these? go ahead send me link
In short, tell us where it is, not what it is.
what did this get -1 for
OMg Yokohane just tell which line is the error at. It should say it next to the error. Otherwise we won't be able to help -.-
@incapaxian Ok reported for that.
@Kiriot22 Just did, and i didnt see anybody who did that before
removed my downvote, this is all i told you to do lmao
Hm. Why are you trying to use the message variable like a table? It's a string
@incapaxian https://scriptinghelpers.org/questions/72415/i-got-this-tostring-error-not-what-i-expected-it-to-be-anybody-can-help-urgent, and now u assume that qns with [URGENT] are bad qns, if u dont wanna help just dont do anything, i dont even care if u give downvote dude, all i care about is that u anyhow give it -_-.
@Kiriot22 ok so how do i make it as a string, i mean someone sent me a link that explains how to index strings. but dont quite get it
they are bad questions. Questions with URGENT in the title are bad questions. There is absolutely no reason to put that in your titles
@incapaxian No what do u mean? Ill give u an example. Sometimes people are doing projects for someone and the deadlines is getting close, then why cant people put [URGENT] in it?
deadline*
You never explained what you want your script to do. Im unsure what you want to do with the message.
Bad excuse, and why are they doing commissions for people if they can't solve their issue? You just look desperate and impatient doing that
@Kiriot22 i only want an explanation of why this happen dude, as i said in the post
The only non nil values for strings are find, gsub, match, gmatch, sub, reverse, len, format, char, byte, and a few more
@incapaxian Ok then what if u cant solve something and u are about to travel in a few days and the country u go has no wifi and u really want to get it done cause u dont wanna come back and forget* everything?
@incapaxian What do u mean by non nil values
I already told you why it happens. It happens because you use a string like a table.
@Kiriot22 oo ok then how do i change it to string?
tostring()
@gioni01 thats what i did dude
@incapaxian i just want u to know this. scriptinghelpers.org is for people to ask and answer qns about scripting, its not a website for u to judge if the qn is bad or good. And if u are lazy to read and know whats going on, just dont, simple. U know what u are doing when u are anyhow giving downvotes just by u thinking oh this qn is "bad"? U are F-ing abusing the power to give downvotes.
@incapaxian And u know what are downvotes for? Its for questions that are against the rule and more, but not for ur personal opinion and judgement. And if u continue to do so, i can guarantee that u will not only get reported by me.
Downvotes exist to rate the quality of a question or answer, so it's not abusing, lol