Block wont go invisible depending on value

Does anyone know why this script isn’t working?
It’s supposed to make the model transparent or not depending on the value.

It’s not changing because the enabled variable doesn’t change when the value itself changes. Put the enabled variable inside the loop after the wait and it should work.

Although I would suggest using GetPropertyChangedSignal instead of using a loop.

You also don’t need to do IsA for Part and BasePart as Part is included under BasePart.

Hope this helps!

1 Like

sorry to bother but what did you mean by put the enabled variable in the loop

Please just copy/paste the script here with 3 backticks (```) before and after, it make it much easier for us to copy and rewrite rather than having to write the entire code.

Why do you have 2 for _, part loops?

Have just one and check to see if enabled = true or false to change the transparency. You also only need to check if it’s true (or false) once since if it isn’t one then it’s automatically the other (or it’s nil). This means you don’t need else if in this case.

for _, part loop  
    if enabled == true then 
        change transparency to 0
    else 
        change transparency to .65
    end
end