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

attempt to concatenate table with string?

Asked by 4 years ago
Edited 4 years ago

Hi! So, I'm trying to script a command for Basic Admin Essentials 2.0. I'm doing it as a plugin in the BAE plugin folder. I want to make a checkwarns command, I want it to say the players name too but when I add ..Player.. it shows the "attempt to concatenate table with string" error. Here's the code :p

    local function pluginFunction(Args)
        local Player = Args[1]
        if Args[3] then
            local Victims = returnPlayers(Player, Args[3]) if not Victims then return end
            local combinedVictims = ''
            for a,b in pairs(Victims) do
                if combinedVictims == '' then
                    combinedVictims = b.Name
                else
                    combinedVictims = combinedVictims..', '..b.Name
                end
            end
            for a,b in next,Victims do
                remoteEvent:FireClient(b,'Notif','Check Warns','The User '..Victims..' has no warns.',{'Message','Results',combinedVictims})
            end
        end
    end

Please help, thanks! Note: this isnt the full code, just the part I think the error is from.

No more help needed! I fixed the issue by simply just replacing..Victims.. with ..b.Name..

0
try using `unpack(Victims)` or `b` at line 14 Leamir 3138 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

On line 14 ur trying to concatenate a table with a string, Victims is a table and ur doing ..

0
So, what do i do to fix it xMas_Ier 1 — 4y
0
Was stupid, forgot to mark this as an answer! xMas_Ier 1 — 3y
Ad

Answer this question