Output Error: Visible is not a valid member of UIListLayout "Players.LovelySunLilac.PlayerGui.RadioGui.Frame.ChatFrame.UIListLayout"
Script:
script.Parent.ChangeFrequency.Event:Connect(function(freq)
frequency = freq
for _,msg in pairs(script.Parent.ChatFrame:GetChildren()) do
msg.Visible = false
script.Parent.ChatFrame.CanvasSize = UDim2.new(0,0,0,0)
end
What is the precise object you are trying to disable the “Visible” property off? A TextLabel?
Something you could do is this;
script.Parent.ChangeFrequency.Event:Connect(function(freq)
frequency = freq
for _,msg in pairs(script.Parent.ChatFrame:GetChildren()) do
if msg:IsA("TextLabel") then -- replace this by whatever object you want to change
msg.Visible = false
end
script.Parent.ChatFrame.CanvasSize = UDim2.new(0,0,0,0)
end
end)
(Thanks to @NyrionDev who told me in DMs that I forgot two end statements.)
UIListLayouts don’t have a “Visible” property you just need to add a conditional to that loop which checks the type of instance being iterated over.
script.Parent.ChangeFrequency.Event:Connect(function(freq)
frequency = freq
for _, msg in pairs(script.Parent.ChatFrame:GetChildren()) do
if msg.Name ~= "UIListLayout" then
msg.Visible = false
end
script.Parent.ChatFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
end
end)
The error was caused by “UIListLayout”, within ChatFrame. The problem was when you looped through it, the system also found “UIListLayout”, which doesn’t have a Visible property causing the error!