Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

GetChildren is not seeing all the objects in gui?

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!

2 comments

0

Why the empty pair of parenthesis at the first end? And does it print every child's Name?

0

yea, and i tryed to make it with two parenthesis, and with one, nothing changes

2 answers

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

end)

2 comments

0

yea, but its not fixing a problem

0

any errors on the output screen?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.