Code formatting

Any sources on this?

characters

I noticed that this tutorial teaches us bad programming practices in general. A notable example is not making services plural if they are, and using multiple get service calls.

Here’s a good video talking about some of these things:

Also, you should use task.wait as it’s more accurate than just wait.

What I think is funny is how you think I wrote the code in that example, and you how you read over this tutorial to criticize it so fast, that you didn’t realize that it was an example of what NOT to do in programming. This tutorial shouldn’t be about what you write, it’s about how you write it.

Side note, I always use task.wait().

Did you reply to the wrong person? If not, please explain yourself as my reply doesn’t really involve what you’ve mentioned.

I mentioned this because the code you’ve shown does not use task.wait.

No I didn’t, and I was referring to the fact that you said use task.wait. The code I used for the example was literally from a website with luau programming examples; for beginners. I didn’t write the code, and this tutorial isn’t about micro optimization and efficient practices. It’s about Code formatting.

This wasn’t even the point of my reply, it was simply a recommendation.

This wasn’t mentioned anywhere in the original post and is irrelevant regardless. I would recommend showing code that uses better practices if you’re going to show improved code.

Aside from the task.wait part, my post had nothing to do with micro optimization, it was about formatting.

1 Like

Since no one wants to explain it, I will elaborate myself.

It’s really not smart to study, but not write notes. Nor is it smart to make a program, but not explain what it is. First of all, it helps you grasp whatever you’re writing, I can verify that for myself, personally. It also can be useful if you write something complicated, or something spaghetti-code-esque, and then come back and don’t understand what you wrote. The same goes for other people reading your code.

And just because they CAN program, doesn’t mean they understand what you wrote.

This just goes back to my point: if you can effectively name identifiers with clean and readable code, there’s no need for comments; it’s self-documented.

Using game:GetService(“Service”) is better because it allows you to:

  • Not error if the name of the Service is not that, as Players will always be Players to game:GetService(“”), instead game. will error if the name of the service is not the one you’ve inserted
  • If the service doesn’t exist it will be created
  • It just looks better to me
1 Like

I agree. It does look better, and is more consistent. You shouldn’t have to change up between :GetService() and indexing directly just because there’s a space in a name. And it’s supposedly faster according to @Dede_4242

1 Like