Script isn't turning children invisible?

Greetings, I’m fairly new to the in pairs function or whatever it’s called, but I’m having trouble with a script. Basically I have walls in a folder to mark where invisible walls are, but for whatever reason, it isn’t working, no errors are popping up in the console either.
Here’s the script:

function WallHandler(w)
	for i,v in pairs(w:GetChildren()) do
		if(v:IsA("BasePart")) then 
			v.Transparency = 1
			v.Locked = true
			
		end
	end
end

Before you ask “Why not just make the walls invisible in Studio?”
The reason for this is is that I like to know where stuff is, think about it like the Hammer editor, you can see stuff in the editor to see where you’ve placed stuff and where stuff is, but when you’re actually playing the map, it’s not there.

1 Like
function WallHandler(w)
	for i,v in pairs(w:GetChildren()) do
		if v:IsA("Part") then 
			v.Transparency = 1
			v.Locked = true
		end
	end
end
1 Like

Nope… That doesn’t seem to work, I’ve tried it with both Basepart and Part and it doesn’t seem to do anything. If it’s due to a placement of the script, I’ve placed it in the same folder as the walls.
image

Is the code you’ve pasted the whole script - do you have something that’s calling your WallHandler function?

1 Like

Ah… Yeah. That was the problem, I forgot to call it. Thank you.

1 Like