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

Help With Issue With Functions?

Asked by
Scootakip 299 Moderation Voter
8 years ago
function MoveWaterDoor(part) -- function to move the Part
    while Button1.Value ~= 1 and Button2.Value ~= 1 and Button2.Value ~= 1 do
        wait()
    end
    for n = 0, MagWDoor, IncrementWDoor do
        WaterDoorer.CFrame = WaterDoorer.CFrame + (DirectionWDoor * IncrementWDoor)
        wait( (TimeWDoor/MagWDoor) * IncrementWDoor )
    end
end

This following function doesn't work. It worked before I added the part where it needs to wait, but now it won't work.

It's supposed to keep the door waiting until three buttons are pressed, and once the buttons are pressed it opens the door. The problem is that the door doesn't open... at least not when the script is complete, as mentioned before.

If anyone could help me figure out this annoying issue, that'd be great, thanks.

1
You wrote Button2.Value ~= 1 twice. I assume the second is supposed to say Button3. 1waffle1 2908 — 8y

2 answers

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

You just need to use or instead of and.

I recommend using BoolValues instead of using ~= 1.

You can also use repeat wait() until ... instead to make it clearer:

repeat
    wait()
until Button1Open.Value and Button2Open.Value and Button3Open.Value
Ad
Log in to vote
0
Answered by
qwrn12 85
8 years ago

The answer mite me you wrote Butten2.Value twice it mite also be you put part as the thing if there are multiple (part)s then it messes it up because it doesn't know which one to choose

Answer this question