Error says element doesn't exist but it does?

I’m making my settings menu, However, when I try to get a specific UI element the throws an error saying that the element doesn’t exist even though it does show in the printed table below where I called GetChildren() and show in the image.



Did you forget “Container” in the script ?

I figured out a work around for this, however, I don’t like It as it would have to keep changing the script if I add a new element.

local Interface = Meido.Interface
local TabFrames = Interface.TabFrames
local Settings = TabFrames.Settings:GetChildren()
local Container = Settings[5]

No, I was doing it properly, Roblox for some reason throws the error.

I believe you should be using WaitForChild() as the script may run before the instance(s) loads.

1 Like

Maybe try and use WaitForChild() ?

1 Like

I tried to use it, however, it just yields after a certain period of time.
And you can also see that I printed GetChildren() before even calling that specific element and it worked.

If you don’t mind, could you please show your code? It can help us better understand what the issue could be (please send the code in text).

Meido is my framework, and that sets the Interface when it runs:

local Meido = require(game.ReplicatedStorage.Meido)

local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local PlayerScripts = Player.PlayerScripts

local PlayerGui = Player:WaitForChild("PlayerGui", 60)
local Interface = PlayerGui:WaitForChild("Interface", 60)
local Workers = PlayerScripts:WaitForChild("Workers", 60)

Meido.Interface = Interface
local Interface = Meido.Interface
local TabFrames = Interface.TabFrames
local Settings = TabFrames.Settings
local Container = Settings.Container

I’m not sure if you tried this already, but try adding WaitForChild for all of the variables

local Interface = Meido:WaitForChild("Interface")
local TabFrames = Interface:WaitForChild("TabFrames")
local Settings = TabFrames:WaitForChild("Settings")
local Container = Settings:WaitForChild("Container")

Still no, It just yields once it waits for Container.

Have you checked to see if the Container instance still exists in-game from the explorer tab? Or maybe a script might be changing its name?

Yeah, I’ve checked multiple times. I’m wondering if this is an engine issue now.

Try renaming the instance, duplicate it and delete the previous instance.

1 Like

Yeah, that worked, So i guess it was an engine bug.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.