--each letter after "Blocker" is a Part. a = script.Parent.Parent.Parent.Blocker.a b = script.Parent.Parent.Parent.Blocker.b c = script.Parent.Parent.Parent.Blocker.c d = script.Parent.Parent.Parent.Blocker.d e = script.Parent.Parent.Parent.Blocker.e f = script.Parent.Parent.Parent.Blocker.f g = script.Parent.Parent.Parent.Blocker.g h = script.Parent.Parent.Parent.Blocker.h i = script.Parent.Parent.Parent.Blocker.i j = script.Parent.Parent.Parent.Blocker.j blockers = {a,b,c,d,e,f,g,h,i,j} function onClicked() blockers.Transparency = 0 blockers.CanCollide = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
In your code, blockers
is a list.
A list does not have a Transparency
property or CanCollide
property, so modifying that would accomplish nothing.
Instead, you have to consider each element in the list:
for index, object in pairs( blockers ) do object.Transparency = 0 object.CanCollide = true end
As DevFrank pointed out, the way you're defining blockers
is unnecessarily long. You could instead just consider all of the Children of script.Parent.Parent.Parent.Blocker
that are Parts.
So we change blockers
to
blockers = script.Parent.Parent.Parent.Blocker:GetChildren()
but make sure each object
IsA
Part:
for index, object in pairs( blockers ) do if object:IsA("BasePart") then object.Transparency = 0 object.CanCollide = true end end
If this "doesnt work", you should consult the output and provide that. Only so much help can be given when you give only a little information.
So when using ":GetChildren()" it creates a table of the children that you have decided to get from the object. Then when using for "for _,v in pairs(example:GetChildren) do" is a more sufficient way then doing, "for i = 1,#example:GetChildren() do". Then we must check if the object is a part in this case, which we use, :IsA("CLASSNAME") . Then after that I believe you understand already.
I will use a better way to do this in your situation.
script.Parent.ClickDetector.MouseClick:connect(function() for _,v in pairs(script.Parent.Parent.Parent.Blocker:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0 v.CanCollide = true end end end)
I also decided to use BasePart
because I never knew it existed.
If you don't understand what I was trying to explain above, then let me post some links to the wiki. I did edit this because I felt that I wasn't telling you enough.
http://wiki.roblox.com/index.php?title=API:Class/Instance/GetChildren
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs
http://wiki.roblox.com/index.php?title=API:Class/BasePart
Don't forget to mark this as solved and as the correct answer!