Fix bug with menu opening custom roblox menu!

i’ve made custom roblox menu but its buggy after all when I open it opens slowly and I renamed the playergui
or sometimes it doesn’t show and if I press the button it doesn’t even detect it /:sweat_smile:

here is the place filer with the script

ytyutyu.rbxl (216.3 KB)

local userInputService = game:GetService("UserInputService")	



userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.Escape then
			-- script.Parent.Menu.Enabled = not script.Parent.Menu.Enabled
			
			
			if input.KeyCode == Enum.KeyCode.Escape and script.Parent.Menu.Enabled  == true then
			game.Players.LocalPlayer.PlayerGuy.Menu.Frame:TweenPosition(

				UDim2.new(0,0,0,0),
				"InOut",
				"Quad",
				1.5,
				false
				)
				wait(1.6)
				script.Parent.Menu.Enabled = false
			else  if input.KeyCode == Enum.KeyCode.Escape and script.Parent.Menu.Enabled  == false then
				game.Players.LocalPlayer.PlayerGuy.Menu.Frame:TweenPosition(

					UDim2.new(0, 0,-0.999, -50),
					"InOut",
					"Quad",
					1.5,
					false
					)
				script.Parent.Menu.Enabled = true
				end
			end
		end
	end
end)