Not A Valid Member Of Frame

I’m trying to make a shop gui system. I keep getting an error saying 16:25:47.654 - EQUIP is not a valid member of Frame. I checked an EQUIP is under the Frame.

local gui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui") 

script.Parent.MouseButton1Click:Connect(function()
  for _, v in pairs (gui.Shop.Stats.Frame:GetChildren()) do
      if v:IsA("GuiBase") then
        v.Visible = false
      end
  end

   gui.Shop.Stats.Frame.LongStick.Visible = true
if gui.Shop.Stats.Frame.LongStick.Owned == true then
	gui.Shop.Stats.Frame.LongStick.Buy = false
	else
		gui.Shop.Stats.Frame.LongStick.EQUIP = false
		end
end)
2 Likes

It might be because the EQUIP is not the child of the frame. Sometimes when i add new GUI into my frame it does not become the child of it, becomes the child of the ScreenGui.

1 Like

Insert this above the line that errors:

print(gui.Shop.Stats.Frame.LongStick:FindFirstChild("EQUIP"))

See what prints.

No do not, it will return nil if it does not exist , that 's what the :FindFirstChild() function is usually used for (to ensure an instance exists).

Use :WaitForChild() to index the Instance returned after yielding the thread .

I know that it will return nil if it doesn’t exist. That’s why i suggested to print it. WaitForChild() makes the script assume that the child will exist in a few seconds or less.

The line right here is throwing an error because you are forgetting the property at the end to change to false. Declaring a UI object “false” can lead to errors!

When I use .Value it says Value is not a valid member of textbutton

Sorry, but what do you mean be declaring a UI object “false” can lead to errors?

This line right here, you’re ending it off with “EQUIP” as false. As “EQUIP” is a UI object, and not a property, it’s going to throw an error, which is what I believe is happening right now. What did you intend to to do with this line of code?

You should file a bug report for this kind of behaviour in #platform-feedback:engine-bugs
This isn’t standard behaviour.

1 Like

Hold on, how can the .Text property of a TextLabel be a boolValue? I assume he is trying to change its visible property. Try using:

gui.Shop.Stats.Frame.LongStick.EQUIP.Visible = false
1 Like