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

map:Clone() not working?

Asked by
P100D 590 Moderation Voter
9 years ago

Here's my code:

maplist = game.ServerStorage.Maps:GetChildren()
mapref = GetMap(maplist)
map = mapref:Clone()

The GetMap function looks like this:

function GetMap(tbl)
    local returntbl={}
    if tbl[1]~=nil then
        for i=1,#tbl do
            table.insert(returntbl,math.random(1,#returntbl+1),tbl[i])
        end
    end
    return returntbl
end

Why is studio telling me that my error is "attempt to call method 'Clone' (a nil value)"? How do I fix this?

Answer this question