of     1   

isaiahmock
#183305784Wednesday, February 10, 2016 3:42 AM GMT

hi i was wondering why this script is wrong (I'm learning) script: function onClicked() local lol = script.parent.parent.Door if lol.CanCollide == true then lol.Transparency = 1 lol.CanCollide = false end if lol.CanCollide == false then lol.Transparency = 0 lol.CanCollide = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
cofunction
#183306169Wednesday, February 10, 2016 3:49 AM GMT

Capitalize your "parent" to Parent.
JarodOfOrbiter
#183306253Wednesday, February 10, 2016 3:50 AM GMT

Because it runs both if statements. if lol.CanCollide == true then lol.Transparency = 1 lol.CanCollide = false elseif lol.CanCollide == false then lol.Transparency = 0 lol.CanCollide = true end We can make it more efficient since it will only be one or the other by switching to else: if lol.CanCollide == true then lol.Transparency = 1 lol.CanCollide = false else lol.Transparency = 0 lol.CanCollide = true end And lastly, since == returns either true or false, true==true kind of is unnecessary since CanCollide is already either true or false. if lol.CanCollide then lol.Transparency = 1 lol.CanCollide = false else lol.Transparency = 0 lol.CanCollide = true end
isaiahmock
#183363560Thursday, February 11, 2016 4:19 AM GMT

I was looking at it and i came with this function onClicked() local lol = script.Parent.Door if lol.CanCollide == true then lol.Transparency = 1 lol.CanCollide = false else lol.Transparency = 0 lol.CanCollide = true end end script.Parent.Parent.ClickDetector.MouseClick:connect(onClicked)
myactivetestplace
#183363764Thursday, February 11, 2016 4:24 AM GMT

Use this.. local lol = script.Parent.Door script.Parent.Parent.ClickDetector.MouseClick:connect(function(click) if lol.CanCollide == true then lol.Transparency = 1 lol.CanCollide = false else lol.Transparency = 0 lol.CanCollide = true end end)

    of     1