Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does the script only work once?

Asked by 9 years ago
script.Parent.ClickDetector.MouseClick:connect(function()
    if game.Workspace.Blind1.Transparency == 0
        then game.Workspace.Blind1.Transparency = 1
        game.Workspace.Blind2.Transparency = 1
        game.Workspace.Blind3.Transparency = 1
        game.Workspace.Blind4.Transparency = 1
        game.Workspace.Blind5.Transparency = 1
        game.Workspace.Blind6.Transparency = 1  
        game.Workspace.Blind7.Transparency = 1  
        game.Workspace.Blind8.Transparency = 1
        game.Workspace.Blind9.Transparency = 1
        game.Workspace.Blind10.Transparency = 1
        game.Workspace.Blind11.Transparency = 1
        game.Workspace.Blind12.Transparency = 1
        game.Workspace.Blind13.Transparency = 1
        game.Workspace.Blind14.Transparency = 1
        game.Workspace.Blind15.Transparency = 1
        game.Workspace.Blind16.Transparency = 1
        game.Workspace.Blind17.Transparency = 1
    else 
        game.Workspace.Blind2.Transparency = 0
        game.Workspace.Blind3.Transparency = 0
        game.Workspace.Blind4.Transparency = 0
        game.Workspace.Blind5.Transparency = 0
        game.Workspace.Blind6.Transparency = 0  
        game.Workspace.Blind7.Transparency = 0  
        game.Workspace.Blind8.Transparency = 0
        game.Workspace.Blind9.Transparency = 0
        game.Workspace.Blind10.Transparency = 0
        game.Workspace.Blind11.Transparency = 0
        game.Workspace.Blind12.Transparency = 0
        game.Workspace.Blind13.Transparency = 0
        game.Workspace.Blind14.Transparency = 0
        game.Workspace.Blind15.Transparency = 0
        game.Workspace.Blind16.Transparency = 0 
        game.Workspace.Blind17.Transparency = 0
    end
end)

That's the script for a window script with blinds. The problem is that in studio (Haven't tried in online mode because its not an active place.) the script will work once. I can click it once to open it, once to close it, and then after that it doesn't work anymore. The output says nothing and i don't know what the problem is.

1 answer

Log in to vote
0
Answered by 9 years ago
script.Parent.ClickDetector.MouseClick:connect(function()
    if game.Workspace.Blind1.Transparency == 0
        then game.Workspace.Blind1.Transparency = 1

You forgot to change the Blind1's Transparency back to 0 once closed.

0
Oh, thanks. I'm an idiot like that sometimes. clalexander 40 — 9y
Ad

Answer this question