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

GetChildren is not seeing all the objects in gui?

Asked by 3 years ago

Hello! So, I making a gui with buttons tab and when you click, it animates. But, somewhy, its only detecting 1 button. Even if i copy it and rename, it will still not work!

Here's my code:

for i, v in pairs((script.Parent:GetChildren())) do
    print(v.Name)
    if v:IsA("ImageLabel") then
        v.Top.Click.MouseButton1Up:Connect(function()
            v.Top:TweenPosition(UDim2.new(0, 0,0, 8),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.1)
            wait(0.1)
            v.Top:TweenPosition(UDim2.new(0, 0,0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.1)
            wait(0.01)
            --v.Top:TweenPosition(UDim2.new(0, 0,0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,0.1)
        end)()  
    end
end 

It's not full, but hope you got my problem, and help if you can!

0
Why the empty pair of parenthesis at the first end? And does it print every child's Name? Spjureeedd 385 — 3y
0
yea, and i tryed to make it with two parenthesis, and with one, nothing changes GravityGouse99938 75 — 3y

2 answers

Log in to vote
0
Answered by
Luathron 185
3 years ago

You are trying to call an rbxscriptconnection Try changing line 10 to just

end)
0
yea, but its not fixing a problem GravityGouse99938 75 — 3y
0
any errors on the output screen? Luathron 185 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Your code looks like it's trying to hide your frames, as your tween is 0.1 seconds long and moves it to 0,0,0. Use

v.Visible = false

rather than that massive block.

Answer this question