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.
You are indexing message
as if it were a table, but it's a string - that is what is giving you the nil
value, which is why you're getting the error message. script.Parent.Parent.Parent.Radio2.Mic.BillboardGui.TextLabel2.Text = "["..player.Name.."]: "..message
should work.
Locked by User#24403 and RubenKan
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?