Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help With Issue With Functions?

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 comment

1

You wrote Button2.Value ~= 1 twice. I assume the second is supposed to say Button3.

2 answers

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.