I can't get the collision to turn on when the event is triggered

Screen Shot 2022-08-25 at 9.23.39 PM
the Invis parts are in a folder if that helps

1 Like

Have you tried adding a print() to see if the event works? Could you show a video? Could you show the hierarchy of your ‘Explorer’ window?

Screen Shot 2022-08-25 at 9.27.58 PM

1 Like

Where is the script located?

[dont mind this]

1 Like

Replace

script.Parent.invis.Transparency = 0
script.Parent.invis.CanCollide = true
script.Parent.invis2.Transparency = 1
script.Parent.invis2.CanCollide = false

with

for _,v: BasePart in ipairs(workspace.Invis:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Transparency = 0
		v.CanCollide = true
	end
end
for _,v: BasePart in ipairs(workspace.Invis2:GetDescendants()) do
	if v:IsA("BasePart") then
		v.Transparency = 1
		v.CanCollide = false
	end
end
1 Like

the script is working thanks man

1 Like

Let me explain why this works.

First of all, you’re trying to access the folders with ‘script.Parent’. It ‘would’ work if the script was inside the folder, but seeing as there’s no scripts in both folders, you should just search for the folders using workspace (this still wouldn’t work as explained below).

Second, there is no ‘CanCollide’ or ‘Transparency’ property for folders. So we would use a for loop to loop through all BaseParts of the folder and then we set their properties.