Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

What are the benefits of bindable functions/events and what to use them for?

Asked by 8 years ago

I've never used Bindable Functions/Events can someone explain to me the importance of them and please explain to me how it could improve my game and how it can benefit my games.

Thank you and I hope someone can answer me!

0
W8 THIS WAS YOUR QUESTION KING LONE CAT!!!!!! dang! greatneil80 2647 — 5y

1 answer

Log in to vote
2
Answered by 8 years ago

Bindable Events and Bindable Functions are great for communicating between two different scripts, namely server sided scripts.

For example say I want to fire an event from Script A, and have it do something in Script B. Well, I can use Bindable Events to fire the custom event from script a with 'BindableEventName:Fire()' in Script A. Then, in Script B, I can write a function, and connect that function to the event with this:

BindableEvent.Event:connect(function()
    print("Hello World")
end)

Bindable Functions act the same way, except instead of just firing an event, they will wait for the function in Script B to return a value. The catch is that unlike RemoteFunctions/RemoteEvents, BindableEvents/Functions can only communicate server-side or client-side, meaning they cannot be used to communicate server-client.

Remember though, you will have to index every BindableEvent/BindableFunction you use in your scripts.

You can read more about BindableEvents and BindableFunctions here: http://wiki.roblox.com/index.php?title=API:Class/BindableEvent http://wiki.roblox.com/index.php?title=API:Class/BindableFunction

*EDIT: Remote Events/Functions are different from Bindable events/functions in that Remote objects can interact between Server AND Client. They are very useful when FilteringEnabled is active.

Links for Remote Events & Remote Functions can be found here: http://wiki.roblox.com/index.php?title=API:Class/RemoteEvent http://wiki.roblox.com/index.php?title=API:Class/RemoteFunction*

Hope this helps! :)

0
Bindable* objects predate ModuleScripts, which are, in my opinion, significantly superior. adark 5487 — 8y
0
Remote* objects however have no viable alternative. adark 5487 — 8y
0
Oh, cool. Didn't know that! AwsomeSpongebob 350 — 8y
0
So Bindable events/functions can be used in local and server scripts I am still not getting what the difference is between Bindable events/functions and Remote events/functions. KingLoneCat 2642 — 8y
View all comments (2 more)
0
Bindables can be used to interact between client sided scripts, or can interact between serversided scripts. Remotes however can interact between client and server. AwsomeSpongebob 350 — 8y
0
That's the gist. Before Binable*s, cross-script communications was limited to the various ValueObjects or Global variables, both of which are bad practice for many reasons. adark 5487 — 8y
Ad

Answer this question