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

attempt to concatenate nil with string?

I have recently made a map voting script but I get an error saying "attempt to concatenate nil with string". Here is where the error is:

if string.match(v.Name, "Votes") then
	print(mapName)
	v.SurfaceGui.TextLabel.Text = mapName.." - ".. votes
end

I assume it is from mapName because whenever it is printed it prints as nil, the mapName variable is a table. Here is where the table is inserted:

function module.MapVoting(dur)
	
	mapVotes = {}
	
	for i,v in pairs(game.Workspace.Lobby.Voting:GetChildren()) do
		table.insert(mapVotes, {order = tonumber(v.Name:match("%u+")); name = getMap(); players = {}})
		if v.Name:match("%u+") then
			print("s")
		end

Please help me I don't know how to fix this.

2 comments

0

Please show the line where mapName is created, it doesn't show enough info.

0

all it says is local mapVotes = {}

1 answer

Just use the string() function :troll: this is random and useless I'm pretty sure

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