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

Getchildren not a member of Frame?

Asked by 9 years ago

The error for this script says " GetChildren is not a member of Frame" on line 12, what is wrong with line 12?

01local BUTTON = script.Parent
02local ITFRAME = BUTTON.Parent.Parent
03local FRAME = ITFRAME.Hull
04local NAME = BUTTON.Text
05local ITEMNAME = FRAME.Itemname
06local SCROLLINGFRAME = ITFRAME.ScrollingFrame
07FRAME.Visible = false
08 
09function on_button1_down()
10 
11    for I,v in pairs (ITFRAME:Getchilrden()) do --Here is the problem <<<<<<
12if v.Name ~=  SCROLLINGFRAME-- item to avoid
13then v.Visible = true
14else v.Visible = false
15 
View all 22 lines...
0
GetChildren is the function, not Getchildren. Wutras 294 — 9y
0
Also, I've already answered your question. Wutras 294 — 9y
0
Also you spelled GetChildren() wrong, you spelled it as Getchilrden() TurboFusion 1821 — 9y
0
I said that already? Wutras 294 — 9y

3 answers

Log in to vote
0
Answered by
Wutras 294 Moderation Voter
9 years ago

That's a pretty simple problem and can easily be solved with a for _, fr in pairs(TlFrame:GetChildren()) do which will do the stuff inside of this and an end to anything inside of this table.

01local BUTTON = script.Parent
02local TlFRAME = BUTTON.Parent.Parent
03local FRAME = TlFRAME.Arbalest
04local NAME = BUTTON.Text
05local ITEMNAME = FRAME.Itemname
06 
07FRAME.Visible = false
08 
09function on_button1_down()
10    for _, fr in pairs(TlFrame:GetChildren()) do
11        if fr ~= FRAME then -- This will prevent the content of the FRAME variable from being changed.
12        fr.Visible = false
13        end
14    end
15    ITEMNAME.Text = NAME
16    FRAME.Visible = (not FRAME.Visible)
17end
18 
19BUTTON.MouseButton1Down:connect(on_button1_down)

If this doesn't help you with your problems or isn't what you needed, simply reply in a comment and I'll see what I can do.

0
This works. Hexcede 52 — 9y
Ad
Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

You wrote "Getchilrden" instead of "GetChildren"

Log in to vote
0
Answered by 9 years ago
01local BUTTON = script.Parent
02local ITFRAME = BUTTON.Parent.Parent
03local FRAME = ITFRAME.SmallHandle
04local NAME = BUTTON.Text
05local ITEMNAME = FRAME.Itemname
06local SCROLLINGFRAME = ITFRAME.ScrollingFrame
07 
08FRAME.Visible = false
09 
10function on_button1_down()
11    for _, fr in pairs(ITFRAME:GetChildren()) do
12        if fr ~= SCROLLINGFRAME then -- This will prevent the content of the FRAME variable from being changed.
13        fr.Visible = true
14elseif fr ~= FRAME then
15        fr.Visible = true
View all 21 lines...

Here is the edited script, It works except it doesn't make all of the other frames that aren't (FRAME) not Visible. I thought else fr.Visible = false would do that because else in this situation would be All of the frames other than SCROLLINGFRAME and FRAME right? But it didn't work

Answer this question