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

Make everything not visible using GetChildren?

I'm trying to set every frames visibility to false within a folder. The folder is located here: script.Parent.Parent.Parent

All the frames are inside this folder.

Why doesn't this work?

script.Parent.MouseButton1Down:connect(function()
		local allinfo = script.Parent.Parent.Parent:GetChildren()
		allinfo.Visible = false
end)

2 comments

0

Even when changing line 3 to player.PlayerGui.allinfo.Visible = false and locating the player at the top of the code it still won't work. The errors is "allinfo is not a valid member of PlayerGui".

0

While FE is enabled, scripts can't access PlayerGui. You should always use a LocalScript for gui stuff.

1 answer

✓ Accepted answer

I think your hierarchy must be mixed up. Are you using a local script? Will this be for all players or just a few? If it is for all players, just use a normal script, cycle through the players and change the frames to visible.

If its only for select players, use a local script and change it for those selected members within there.

**Hierarchy:**I wouldn't access the gui by doing script.Parent.Parent.Parent ect., instead, find out where the gui is from game.Players.LocalPlayer and access it that way.

Note... If your gui is in StarterGui then is will be stored under game.Players.PlayerGui exactly as it is under StarterGui

--normal script
for _, player in ipairs(game.Players:GetChildren()) do
	frames = player.PlayerGui.PathToFrameFolderHere:GetChildren();
	for i = 1, #frames do
		frames[i].Visibility = true;
	end;
end;


--local script
condition = true; --boolean to see if you want to set frame visible for this particular player

if(condition) then
	frames = game.Players.LocalPlayer.PlayerGui.PathToFrameFolderHere:GetChildren;
	for i = 1, #frames do
		frames[i].Visibility = true;
	end;
end;

2 comments

0

script.Parent.MouseButton1Down:connect(function() frames = script.Parent.Parent.Info:GetChildren for i = 1, #frames do frames[i].Visibility = true end end) --script doesn't work, and the for loop must be missing something...Right?

0

There needs to be a function call on the GetChildren, and the property is Visible rather than Visibility

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