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

How do I make this open the children in the File?

Errors: None Problem: Doesn't make the Children Visible

script.Parent.MouseButton1Click:connect(function()
		if script.Parent.Parent.Jobs.TeacherButton.Visible == true then
		script.Parent.Parent.Jobs.TeacherButton.Visible = false
		script.Parent.Parent.Jobs.TextLabel.Visible = false
		end
	local OpenApps = script.Parent.Parent.Apps:GetChildren()
	OpenApps.Visible = true
end)

2 comments

0

thats because you are trying to set a table to visible? you have to do it indivuay

0

It does make Visible true.

1 answer

:GetChildren() returns an array for all the children in the instance that the method was called on. when working with arrays, you want to loop through them, the best way is by using a generic for-loop, like so.

script.Parent.MouseButton1Click:connect(function()
	if script.Parent.Parent.Jobs.TeacherButton.Visible == true then
		script.Parent.Parent.Jobs.TeacherButton.Visible = false
		script.Parent.Parent.Jobs.TextLabel.Visible = false
	end
	local OpenApps = script.Parent.Parent.Apps:GetChildren()
	for _, child in pairs(OpenApps) do
		child.Visible = true
	end
end)

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