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

3 comments
You made an empty array, tab, and you are trying to access something that again, can’t exists, because it’s empty
what is this
I found a way to fix my bug