I'm not sure what is wrong. this is my first time doing scripting in lua but i know python. The code works except the if statements and i think there is a problem when i try to change "switch" between true and false. The code changes the part "load" to either transparent and non collide or solid and collide depending on what switch is.
here is the code:
switch = true
if swtich = true
function onClicked()
script.Parent.Parent.load.Transparency = 1
script.Parent.Parent.load.CanCollide = false
swtich = false
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)
if swtich = false then
function onClicked()
script.Parent.Parent.load.Transparency = 0
script.Parent.Parent.load.CanCollide = true
swtich = true
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)
