Creating custom events
Previously, we learned that no event gets fired when a character jumps. We started listening to a changed event on a property. This works perfectly. Our current script changes the color of the avatar on a jump change. But what if we wanted to create another script that slowly increases the size of the player’s head. This script needs to listen to the same Jump property, too. Multiple scripts having the same code is a Bad Smell. This is where Custom Events come in handy.
In the following sections, we will learn how to create custom events using bindable events and functions. After that, we will compare them to modules. Finally, we will combine bindable events and modules.
Using bindable events
To make our custom event, we will make a new script. This script will be responsible for managing the event. Then, other scripts can listen to this new event.
But how do we make a custom event? Roblox has something called BindableEvents. These are instances...