generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How To Create Event

Previous Thread :: Next Thread 
Fiora46 is not online. Fiora46
Joined: 22 Jun 2016
Total Posts: 4
28 Jun 2016 01:41 PM
I want Create Event
Report Abuse
Soybeen is not online. 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
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image