Unexpected If

Hey!

I am very new to haxe and I am encountering an error.

Whenever I add a “}” where it tells me to, the line of code after it is “unexpected” so when I remove it to prevent that it just tells me to add the “}” again, I don’t know what to do. Here is my code,

if ((controls.ACCEPT) && (!selectedSomethin))
		{
			//
			selectedSomethin = true;
			FlxG.sound.play(Paths.sound('confirmMenu'));

			menuSprites.forEach(function(spr:FlxSprite) {
			spr.animation.play('confirm');
			{
					spr.kill();
			}
		});
	}
			menuItems.forEach(function(spr:Alphabet)
			{
				if (curSelected != spr.ID)
				{
					FlxTween.tween(spr, {alpha: 0}, 0.4, {
						ease: FlxEase.quadOut,
						onComplete: function(twn:FlxTween)
						{
							spr.kill();
						}
					});
				}
				else
				{
					FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
					{
						var daChoice:String = optionShit[Math.floor(curSelected)];
						FlxG.mouse.visible = false;
						switch (daChoice)
						{
							case 'schizo':
								// Nevermind that's stupid lmao
								PlayState.storyPlaylist = ["Schizophrenic"];
								PlayState.isStoryMode = true;
								PlayState.seenCutscene = false;

								var diffic = CoolUtil.difficultyStuff[curDifficulty][1];
								if (diffic == null) 
									diffic = '';

								PlayState.storyDifficulty = curDifficulty;

								PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
								PlayState.storyWeek = 1;
								PlayState.campaignScore = 0;
								PlayState.campaignMisses = 0;
								new FlxTimer().start(0.5, function(tmr:FlxTimer)
								{
									LoadingState.loadAndSwitchState(new PlayState());
									FlxG.sound.music.volume = 0;
									FreeplayState.destroyFreeplayVocals();
								});
							case 'freeplay':
								MusicBeatState.switchState(new FreeplayState());
							case 'options':
								MusicBeatState.switchState(new options.OptionsState());
						}
					});
				}
			});
		}
}
		if (Math.floor(curSelected) != lastCurSelected)
			updateSelection();

Hej,

You have 2 closed brackets too much before the last end the code should be like that :

if ((controls.ACCEPT) && (!selectedSomethin))
		{
			//
			selectedSomethin = true;
			FlxG.sound.play(Paths.sound('confirmMenu'));

			menuSprites.forEach(function(spr:FlxSprite) {
			spr.animation.play('confirm');
			{
					spr.kill();
			}
		});
	}
			menuItems.forEach(function(spr:Alphabet)
			{
				if (curSelected != spr.ID)
				{
					FlxTween.tween(spr, {alpha: 0}, 0.4, {
						ease: FlxEase.quadOut,
						onComplete: function(twn:FlxTween)
						{
							spr.kill();
						}
					});
				}
				else
				{
					FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
					{
						var daChoice:String = optionShit[Math.floor(curSelected)];
						FlxG.mouse.visible = false;
						switch (daChoice)
						{
							case 'schizo':
								// Nevermind that's stupid lmao
								PlayState.storyPlaylist = ["Schizophrenic"];
								PlayState.isStoryMode = true;
								PlayState.seenCutscene = false;

								var diffic = CoolUtil.difficultyStuff[curDifficulty][1];
								if (diffic == null) 
									diffic = '';

								PlayState.storyDifficulty = curDifficulty;

								PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase());
								PlayState.storyWeek = 1;
								PlayState.campaignScore = 0;
								PlayState.campaignMisses = 0;
								new FlxTimer().start(0.5, function(tmr:FlxTimer)
								{
									LoadingState.loadAndSwitchState(new PlayState());
									FlxG.sound.music.volume = 0;
									FreeplayState.destroyFreeplayVocals();
								});
							case 'freeplay':
								MusicBeatState.switchState(new FreeplayState());
							case 'options':
								MusicBeatState.switchState(new options.OptionsState());
						}
					});
				}
			});
		// } <<------------
// } <<---------------  
		if (Math.floor(curSelected) != lastCurSelected)
			updateSelection();