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

Why are Frames' properties suddenly unable to be set false or true by a script?

I'm coding a page system for a character customization GUI so the user can view every element without them all being on-screen at once. This code immediately comes after I set up the bulk of the system.

for _,f in pairs(tsp:GetChildren()) do
		for _,f2 in pairs(f:GetChildren()) do
			if f.Name == "page1" then
				-- f:GetChildren()[table.find(f:GetChildren(),f2,1)].Name 
				tsc[f2.Name].Visible = true
				tsc[f2.Name].BackgroundTransparency = 0
			else
				tsc[f2.Name].Visible = false
				tsc[f2.Name].BackgroundTransparency = 1
			end
		end
	end

When the script reaches here, I get the error Visible cannot be assigned to at tsc[f2.Name].Visible = false, even though there were no issues at all for months until yesterday. Then hours later, the error occured at tsc[f2.Name].Visible =true, and then an hour later the error went back to occuring at tsc[f2.Name].Visible = false.

The error also only occurs when I set tsc[f2.Name].BackgroundTransparency to 1, but not to 0. There were also no problems with this for months until yesterday.

This is hindering my progress; I saved the script and restarted ROBLOX Studio, I rearranged the code, I even rewrote a simple line to tsc[ f:GetChildren()[table.find(f:GetChildren(),f2,1)].Name ].Visible = true to get the specific name of f2, and the error still occured when set to false, and now when set to true.

Help is greatly appreciated!

3 comments

0

you are not checking if the object has the property .Visible, therefore, it can and will error if it encounters something that doesn't have .Visible property (i.e. script, uicorner)

0

say, for example, UICorner.Visible = false

0

to counter this you could check if it is a Frame or a ScrollingFrame or whatever with :IsA()

1 answer

Is the ".Name" getting the literal name of the frame and not the frame inside of it named "Name" if that's what you need? That could be why it's acting up sense you can't set a frame's "Name" with visible properties. Not sure how you have your gui's set up though.

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