Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

attempt to concatenate nil with string?

Asked by 2 years ago

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.

0
Please show the line where mapName is created, it doesn't show enough info. T3_MasterGamer 2189 — 2y
0
all it says is local mapVotes = {} aydenwilson819 25 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

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

Ad

Answer this question