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 » Scripting Helpers
Home Search
 

How can I do this? [LuaLearners]

Previous Thread :: Next Thread 
glassklart is not online. glassklart
Joined: 07 Aug 2011
Total Posts: 1736
17 May 2013 11:56 AM
Make a brick that does the following:

Change the color when touched.

Kills the player that touched it

Moves the brick to a random location between 0 and 20 on all axis

Inserts a message into workspace that says somebody touched the part


The name of the brick in workspace is called "Part".


-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX --
Report Abuse
cooldude816 is not online. cooldude816
Joined: 03 Jan 2009
Total Posts: 27759
17 May 2013 11:59 AM
Wiki the onTouched() function.

The lonely sentinel..
Report Abuse
cheesecake123456 is not online. cheesecake123456
Joined: 01 Jun 2009
Total Posts: 1529
17 May 2013 12:41 PM
Wow. Your are supposed to read the tutorials/wiki so that you understand how to do that. It's an assessment to see if you have learned everything, so go back and read the tutorial.

Soup's on, everybody!
~LuaLearners Writer~
Report Abuse
glassklart is not online. glassklart
Joined: 07 Aug 2011
Total Posts: 1736
17 May 2013 03:46 PM
I know. The reason why I posted it is so I can see an example. I don't understand functions.

-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX --
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
17 May 2013 03:52 PM
function onTouched(hit)
--Do your stuff
end

script.Parent.Touched:connect(onTouched)
Report Abuse
glassklart is not online. glassklart
Joined: 07 Aug 2011
Total Posts: 1736
17 May 2013 03:57 PM
Thanks. Can anyone help me learn functions?

-- Fᴏʟʟᴏᴡ ᴍᴇ ᴏɴ Tᴡɪᴛᴛᴇʀ @ɢʟᴀssᴋʟᴀʀᴛRBLX --
Report Abuse
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
17 May 2013 08:13 PM
functions are just parts of script that fire when you say. Example.

------------------------
print ("Script Fired")
------------------------
This will fire when the script is enabled, printing "Script Fired" in the Output window.

------------------------
function Hello()
print ("Script Fired")
end

script.Parent.Touched:connect(Hello)
------------------------
This wil fire when the "script.Parent" gets touched. Aka, the part the script is in.

------------------------
Part = script.Parent

function Name()
print ("Script Fired")
end

Part.Touched:connect(Name)
------------------------
This is the same as above, but I made a Variable. Notice the connection line is different.

The name of the function comes after "function". This allows you to tell the script what to fire. Notice, my silly names above. It doesn't matter what you name it, as long as your connection line can find it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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