How To Keep Code Clean Part: 1

What is a multi-line commenter?
Comments spannning multiple lines?

Variables shouldn’ t be used to just make code cleaner but they should be used to optimize code too, variables are really useful when it comes to optimizing code and making it better and faster and in some cases even more functional with checks.

1 Like
--[[
Hey look at me I' m an amazing long comment
I can do this!
And this!
]]

--Hey look at me.
--I' m ugly.
--Never use me please.
--End me please I can' t bare this suffering.
1 Like

Thanks! I’ll update the post when I can

1 Like

I just noticed this in your reply and I didn’t notice it before… I’m blind.

Anyway, it’s a number, so it’s not a Variable name because it has a number before it

the issue is that it’s in light mode, I prefer dark mode over light mode

1 Like

I disagree. wait does throttling while task.wait does not. Although less accurate, switching back to wait has had a significant performance improvement for me.

Both are useful and it depends on design.

It’s still recommended and in fact I don’t really see massively how it would affect a large amount of performance. Basically everyone is using it now and I have seen no one else complain about there being performance issues.

Wait() should really never be used now because Roblox has made it Deprecated and even though I don’t really think there should be any issues with wait() even though it is deprecated its best practice to use the new version.

Source? I’ve never seen the documentation recommend it. If so, that is an error in the docs.

In one of my poorly designed games with a script per NPC, making the update timer rely on wait instead of task.wait has massively improved performance if there’s more than, say 300 of the NPCs roaming around. That is because wait throttles.

It has also visibly reduced the amount of server stuttering my game has had. Not only that, but it is also shorter to type!

It is all a balance. If you want an accurate wait time, use task.wait. If you want throttling for a smoother experience, use wait. Although the difference is miniscule at first, when the server is under heavy load, wait is much more performant than task.wait.

This is knowledge that very few people know of at the moment, and I am sharing my findings with you. I am aware that this is not your experience but I’m sharing mine. I’d recommend using wait for inaccurate fast wait times and task.wait for lengthy wait times (like intermission).

This might also be the case with spawn but I haven’t tried it.

Wait() is identical to wait(). Spawn() is identical to spawn(). Just like how Workspace is identical to workspace.

They are not as consistent and are a hassle to type them as a PascalCase, which is why I’d assume they were changed to snake_case/camelCase, and the old versions were deprecated.

1 Like