hello my script is not working, can somebody help fix it?
local state = script.Parent.Parent.Parent.Value
local IgliA = script.Parent.Parent.Parent.iglia
local IgliB = script.Parent.Parent.Parent.iglib
function onClicked()
if state == 0 then
IgliA.Transparency = 0.8
IgliB.Transparency = 0
IgliA.CanCollide = false
IgliB.CanCollide = true
state = 1
end
if state == 1 then
IgliA.Transparency = 0
IgliB.Transparency = 0.8
IgliA.CanCollide = true
IgliB.CanCollide = false
state = 0
end
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)

3 comments
Your variable [[state]] has the value of what the Value is at the time you make the variable. remove .Value at the end and then add .Value in your if statements
And of course add .Value when you change the value of [[state]]
@Spjureeedd, I recommend you make that an answer and not a comment.