[Post is Outdated]

1 Like

Sometimes player has loaded before PlayerAdded listener is connected that’s why it’s a “safe” method where it loops thru the existing players.

2 Likes

the module returns a function that can be run normally.

means function takes Player as a param and returns nothing

A module can return anything it doesn’t just have to be a table.

2 Likes

To elaborate, this is Luau type annotation. Luau is Roblox’s own fork of Lua which is what the engine runs on. It adds a bunch of new features and optimizations to the preexisting language; the gradual type system being one of them. You can learn more on their website here.

Basically, type annotations are comments in your code that tells the IDE (the script editor) more about your script and what it does. This in turn allows it to help you back by catching more potential coding mistakes and making better autocomplete predictions. It’s all very neat stuff, but it can get redundant and it’s difficult to master. However, the overall productivity boost makes it totally worth it.

Here’s a quick YouTube video demonstrating the use of type annotations:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.