If the error object is already a table, forward it directly. Local function makeErrorHandler(traceback) Seems like a LOT of extra work from constructing an object. But no way I would use that function instead of a simple coroutine / spawn lol. I included coroutines in the example since I didn’t want to drop some external library and make the code confusing.ĭon’t get me wrong, evarea is a great coder. But I’d rather not create a bindable + connection each time I want to create a thread even in moderation.Ĭheck this out evarea is not a reliable sourceĮither way, I use Promises a lot in my code and fer works really well for me (this is about eveara’s library). These tasks include detecting player input, animating characters, updating the physics simulation, and resuming scripts in a wait() state."Ī custom spawn uses bindables which neglects the cons of coroutines and the delay of spawn which is good. ![]() " The task scheduler coordinates tasks done each frame as the game runs, even when the game is paused. The timing of how much spawn can yield depends on how much you spam spawn because of internal work in the task scheduler due to the fact that yielding tasks are managed in the scheduler. Spawn() is delayed since it uses wait() but it only yields for 0.03 seconds. Threads are not meant to be spammed in the first place even if it’s just a “benchmark” just like stated. Instead of trying to find solutions to how to make spawn bad by spamming 100 - 1,000,000 spawns, it is better to use more practical proof. Player.CharacterAdded:Connect(onCharacterAdded)Ĭoroutines V.S. You should probably use FastSpawn instead of coroutines if you want good errorsĬoroutine.wrap(onCharacterAdded)(player.Character) Not a big deal since it simply errors, but if you'd like to remove some random errors. Possible bug since the character may not exist after 1.2 seconds, even though we did a check. Use the condition of while x do to check if character and ![]() while wait() do isn't the best practice. Local humanoid = character:WaitForChild("Humanoid") I prefer a little more verbose variables. Local function onCharacterAdded(character) Local player = Players.LocalPlayer - no need to wait for LocalPlayer So like this: local Players = game:GetService("Players") Don’t forget to call the function in CharacterAdded if the player.Character exists!Īlso made a few edits that I think would improve your code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |