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

Math.random error?? :/

Asked by 10 years ago

I really have no idea why its erroring..

for _,v in pairs(workspace:GetChildren()) do
        if v.ClassName == 'Model' and v.Name == 'Spawns' then
            for _,i in pairs(v:GetChildren()) do
                if i.ClassName == 'Part' then
                    local h = i[math.random(1,i)]  -- Error here.
                    plr.Character:MoveTo(Vector3.new(h))
                end
            end
        end
    end

Answer this question