New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Table return nil ,please help?

Asked by 10 days 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 Feahren 2005 — 10d
1
what is this Fifkee 1194 — 10d
0
I found a way to fix my bug tylergoatboy 48 — 8d

Answer this question