Ad
Log in to vote
0

String expected, got table in for loop?

Asked by 13 days ago
Edited 13 days ago

So I get the following error :

Unable to assign property Name. string expected, got table - Studio 15:48:03.526 Stack Begin - Studio 15:48:03.527 Script 'Players.xTrippyTerror.PlayerGui.Char.LocalScript', Line 44 - Studio (Line 44 is "Clone.Name = v", but it happens for any line where v is involved.)

Here's the loop:

for i,v in pairs(Names[1]) do
    local Clone = script.NameTemplate:Clone()
    Clone.Name = v
    Clone.Text = v
    Clone.Parent = Container.Names.First
    Connections3[#Connections3 + 1] = Clone.MouseButton1Click:Connect(function()
        CustomizationData.FirstName = Clone.Text
        Container.CharName.Text = (CustomizationData.FirstName or "Nothing") .. " " .. (CustomizationData.SecondName or "Nothing")
    end)
end

Here's where it gets the names from, in another module script:

local It = {}
It.Data = {
    Names = {
        "Alex'",
        "Random",
        "Test",

    },
}

function It:ReturnNames()
    return It.Data
end


return It

Answer this question