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

Table return nil ,please help?

Asked by 4 years ago

table return nil the table gets the names and places them right but when i try to get the name to compare them it prints nil

prints 3 Lava Spiner Lava Spiner

and Lava Spiner 3 nil

local tab={}
for i,v in pairs(script.Parent.Parent.Frame.obbyremove:GetChildren())do
        for e,r in pairs (v.obbyview:GetChildren()) do
    if r.Name~="Camera" then

        table.insert(tab,v:WaitForChild("location").Value,r.Name) ---here
        print(v.location.Value)                 --prints
        print(r.Name)                           --prints
        print(tab[v.location.Value])                --prints
    end

        end


    end
    --obbycheck
    local obby=game.Workspace.Terrain.Obbyplot:FindFirstChild(values.Obbyname.Value)
    local maxed=false
    local obbynumberposition=1
    repeat 
        wait()
        for i,v in pairs(obby.Obby:GetChildren())do
            if v.ID.Value==obbynumberposition then
                if v.Name==tab[obbynumberposition]then       -- here
                    obbynumberposition=obbynumberposition+1
                else

                    maxed=true
                    print(v.Name)                   --prints
                    print(obbynumberposition)       --prints
                    print(tab[obbynumberposition])  --prints
                end
            end
        end
    print(obbynumberposition)
    until maxed==true or obbynumberposition >=#tab
1
You made an empty array, tab, and you are trying to access something that again, can’t exists, because it’s empty Ziffixture 6913 — 4y
1
what is this Fifkee 2017 — 4y
0
I found a way to fix my bug tylergoatboy 82 — 4y

Answer this question