I have been wondering for a while and tried something that doesn't work.
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent:GetChildren().Visible = false
end)
I have been wondering for a while and tried something that doesn't work.
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent:GetChildren().Visible = false
end)
GetChildren will return an array of Instances that descend one step below the called upon Object. If I create an arbitrary table of elements to represent Instances, you can visually see why this isn’t working:
{1,2,3}.Visible = true
To actually reach the Instance to change a property, you must reference it within the table, or use a pairs loop to traverse to it, or iterate through multiple Instances to apply the same change.
local ScreenGui = script:FindFirstAncestorOfClass("ScreenGui")
local Children = ScreenGui:GetChildren()
for _,Frame in pairs(Children) do
if (Frame:IsA("Frame")) then
Frame.Visible = true
end
end
It seems to not work.
I accidentally said True my apologies, however you should’ve caught this so please next time understand the code instead of copy-pasting.
Oh lmao sorry. Thank you!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
I fixed my issue.