private void saveBtn_Click(object sender, EventArgs e) { DiscordHandler.SaveState(); SaveFileDialog save = new SaveFileDialog(); save.Filter = "Lua File|*.lua"; save.Title = "Save file"; if (save.ShowDialog() == DialogResult.OK) { DiscordHandler.SavedState(); System.IO.StreamWriter save2 = new System.IO.StreamWriter(save.FileName); save2.Write(webBrowser1.DocumentText); save2.Close(); } }