Fiora46
|
  |
| Joined: 22 Jun 2016 |
| Total Posts: 4 |
|
| |
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 28 Jun 2016 01:42 PM |
Right click in the explorer >Insert >Basic Object >RemoteEvent
I'm pretty sure, though, this isn't what you mean.
|
|
|
| Report Abuse |
|
|
| 28 Jun 2016 02:15 PM |
Give that your account seems fairly new, I'll assume you want to make a function that handles an event. They are sometimes called listeners. First, you'll need to understand functions.
A function is a block of code that can be used at any point in the same script. A simple function may say:
function hi() print "Hello, world!" end
If you run that script, nothing happens. That's because functions don't do anything until you tell them to. Add this on line 4:
hi()
Your function should now print Hello, world! into the output box. That is because you called the function named hi. Simple enough?
Let's get back to events.
You don't need to create an event. They already happen. Hundreds a second sometimes! But these events are usually lonely... Nothing really happens when these events occur. That's because there's nobody listening...
You can change that. You can make a function "listen" to the event. This means every time the event happens (or what we call "fires"), the function will run. Delete line 4 and put this instead:
workspace.Part.Touched:connect(hi)
Make sure there is a brick in workspace named Part. Now every time this part touches something, the script will say Hello, world!
There are literally hundreds of events, as mentioned before. There's events for clicking on things, when a player goes afk, and almost everything. They are extremely useful for making games. When you become advanced, you can even make your own events; however, that is a little bit out of the scope for this tutorial.
Feel free to ask questions if you don't understand!
- Winter
|
|
|
| Report Abuse |
|