This issue has affected me 8 times already in the past 2 weeks.
I have lost a lot of progress because of this and even had to completely rewrite 6 scripts!
This is an extremely bad issue as anything can crash instantly very easily. Examples of what this issue could cause for people:
Imagine copying a piece of code from a test server right as your laptop with 2.1GHZ cant handle the place for a split second, you’d copy it into the actual game place and boom it freezes instantly and you’ve lost tons of progress.
Testing a piece of code you started working on in a new baseplate and the place freezes, you realise you had copied the code before, so you start a new baseplate and paste the code in there and then it freezes aswell, which means you have lost the code forever.
Accidently editing the script in a test server and you then copy the code and force close the test, while its still working on closing the server you pasted the code in the actual game and it freezes instantly.
Repro steps:
Launch 2 baseplate games.
Create a serverscript in both games in workspace.
Paste this in the script in the first place:
while true do
print("h")
end
Copy the code out of the script and paste it in the runbar.
Execute the code by pressing enter in the runbar, the first game will now freeze in studio.
Paste the code in the script from the second game without closing the frozen game.
I think this is a thread problem. Most likely, the game will freeze up because the thread that created the script or the Runbar thread won’t yield and won’t give the roblox engine time to do anything else.
Edit: typically wait is used to generate delays, but it is also used to yield threads. That’s what it says in the manual
Yields the current thread until the specified amount of seconds have elapsed.
You’re still misunderstanding this post. The script provided there is run on place (A) to intentionally freeze it, and then the script is pasted on another place (B) without running it. That shouldn’t crash place B, but it does. This is also happening in studio, not in-game.
Personally I don’t think it has anything to do with copying and pasting code into different studio instances. Rather, the instances are not completely independent, perhaps for reasons of efficiency.
What I believe that it happens is that, it is executing a thread that never yields (the infinite loop) and it blocks the first instance. But as the instances of the engine are not completely independent, then it ends up blocking the second instance. But this is just a guess.
What is clear to me is that we should never create threads that never yield, and that was my intention from the beginning. Because I believe that there is not and will not be any situation where we intentionally require a thread that never yields (unless it is malware)
But the place can freeze up by itself instead of being intentionally being caused with a while true do loop, meaning this issue could come up in actual situations too. The OP also provided examples of this in the original post.
One blocked instance of the engine could eventually cause the others to be blocked (this is only for Studio). But this is a guess and the only one who could verify this is a Roblox engineer. That’s why I didn’t want to focus on this.
In this experiment there is clearly a thread that never yields:
So that must be the problem that must be solved if it were to happen in a real case.
Thanks for the report and we will work on a fix, but it won’t be easy as it is a OS level issue. Windows clipboard tries to get information from the source application when you paste the text into another application. It is not possible while the source application is irresponsive. Until we can work around this problem to find a fix, please try to avoid getting yourself into this situation, like @lykyob has suggested above.