Title says it all. I tried to search a solution in another topics, but the only one that has a script like mine has no responses
local Folder = script.Parent
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("BobOS"):WaitForChild("Graphics")
--//StartMenu
Folder.StartMenu.Changed:Connect(function()
if Folder.StartMenu.Value == true then
PlayerGui:FindFirstChild(Folder.StartMenu.Name).Visible = true
else
PlayerGui:FindFirstChild(Folder.StartMenu.Name).Visible = false
end
end)
Folder.StartMenu.Changed:Connect(function()
local startMenu = PlayerGui:FindFirstChild(Folder.StartMenu.Name)
if not startMenu then return warn("Invalid object, object not found)"
if Folder.StartMenu.Value == true then
startMenu .Visible = true
else
startMenu .Visible = false
end
end)
Can you send a screenshot of what PlayerGui looks like in explorer, I think the issue is that you’re checking the child of the PlayerGui, instead of the correct folder.
Because you just stated that it’s parented to the folder, not to the PlayerGui, so you have to instead :FindFirstChild() from the folder.
I think the error is because “StartMenu” is not directly parented to “Graphics”
But when I try using :FindFirstDescendent() I receive FindFirstDescendant is not enabled
Why aren’t you just typing PlayerGui.StartMenu.Visible = true/false? it will have the exact same behavior.
Edit: Just read one of your replies, to make FindFirstChild recursive you have to pass true as the second parameter(so it acts as find first descendant):
Folder.StartMenu.Changed:Connect(function()
local StartMenu = PlayerGui:FindFirstChild("StartMenu", true)
StartMenu.Visible = Folder.StartMenu.Value
end)
Yeah I thought about that too, but first I thought if I specified the folder that I want to locate the Child I would avoid that. And also when I change the name it still happens for some reason:
The issue is that the folder is called “Opened” not “StartMenu”
Also I am getting a bit confused, can you send another screenshot with the button you’re pressing marked and whatever frame you want to activate also marked.
Pretty confusing naming here:
local PlayerGUI = blah…graphics folder.
The you try to find the first child called Folder in the graphics folder (aka playergui) for the startmenu. Logically then the startmenu must be a sibling of the script?
But as your screen shot shows it isn’t.
local Folder = script.Parent
local Graphics = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("BobOS"):WaitForChild("Graphics")
--//StartMenu
Folder.StartMenu.Changed:Connect(function()
if Folder.StartMenu.Value == true then
Graphics.Desktop.Background.StartMenu.Visible = true
else
Graphics.Desktop.Background.StartMenu.Visible = false
end
end)