I'm trying to make the Children of these bricks CanCollide True/False And transparency change OnClick. Here's my Script.
local isOn = true
function on() isOn = true script.Parent.Pos1.GetChildren().CanCollide = true script.Parent.Pos1.GetChildren().Transparency = 0 script.Parent.Pos2.GetChildren().CanCollide = false script.Parent.Pos2.GetChildren().Transparency = 1 end
function off() isOn = false script.Parent.Pos1.GetChildren().CanCollide = false script.Parent.Pos1.GetChildren().Transparency = 1 script.Parent.Pos2.GetChildren().CanCollide = true script.Parent.Pos2.GetChildren().Transparency = 0 end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.Pos1.GetChildren().ClickDetector.MouseClick:connect(onClicked) script.Parent.Pos2.GetChildren().ClickDetector.MouseClick:connect(onClicked)
on()

1 comment
Thanks.