Over the last week or so I've been making Mr. Beast's Finger On The App in Roblox and I just got done with the main screen. I want to make it so when the Play TextButton is pressed, an event will fire that will make all the children in the frame disappear. I've tried multiple scripts using the Visible property that I don't have saved, but it doesn't matter because they didn't work. I am fairly new to this, so I apologize for any simple mistakes I may have made. I thought maybe I could make a for i, v in pairs loop to make the frame children disappear one by one. I do have this script saved though, and it goes as follows. (Remember that the Play button is the script's parent)
local tbt1 = script.Parent local Frame = game.StarterGui.ScreenGui.Frame local FrameChildren = {Frame:GetChildren()} tbt1.MouseButton1Click:Connect(function() for i, v in pairs(FrameChildren) do FrameChildren.Visible = false end end)
I also put this in a LocalScript, so that might have something to do with this. Remember, I am not requesting for a script. I just want to improve on a current one to make it work. I am kind of new, so please don't bully me if I missed a simple error. Please tell me your solutions and I'll be glad to respond!
First of all your method gets all the children in a frame and makes it invisible. But if you make a frame invisible the "children" of the frame will be set to invisible too, the same goes for visible too. But what you wanted is making the children disappear.
So first you have mistakes on making a frame children since you can just use Frame:GetChildren() but here is your error. If you want to make all the descendants disappear you need to use :GetDescendants(). This could be your error.
local tbt1 = script.Parent local Frame = game.StarterGui.ScreenGui.Frame local function hasProperty(object, prop) local Returned = object[prop] end tbt1.MouseButton1Click:Connect(function() for i, v in pairs(Frame:GetDescendants()) do local success = pcall(function() hasProperty(v, "Visible") end))-- checking if it has the visible property if success then FrameChildren.Visible = false end end end)