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
 

Can someone teach me LUA?

Previous Thread :: Next Thread 
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 02:34 PM
I wanna be able to make front page worth places, which aren't free model xD
Report Abuse
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 02:37 PM
or a site possibly
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
15 Jun 2013 02:38 PM
http://wiki.roblox.com/index.php/Scripting
lua.bz
http://www.roblox.com/Groups/group.aspx?gid=372
http://www.roblox.com/Groups/group.aspx?gid=96651

These are great places to start learning, if you ever run into a problem, bring your broken code here, and we will gladly help you fix it.
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
15 Jun 2013 02:38 PM
Hey, don't you LMaD?

That's beside the point; you can start learning Lua through the wiki!

wiki.roblox.com/index.php/Scripting

It'll be your main source of reference later on after you've mastered the basics.
A lot of people will also recommend the site LuaLearners.

Personally, the best way to learn how to script is to practice. I tend to script with some friends of mine and challenge myself, so that I learn something new and get to practice and improve older methods.
Report Abuse
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 02:38 PM
@frost

Yes I do.
Report Abuse
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 03:00 PM
So i'm looking at

local brick = Workspace.Part

I inserted a "Part" into the workspace,

Now would it be

brick.Touched:connect (onTouch)

on the 2nd line?
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
15 Jun 2013 03:03 PM
That would be the connection line for a function.

The function can be anything, but the most important thing is that it has to match the word in parenthesis.

For example, you said:

brick.Touched:connect (onTouch)

Alright, but now you need a function with "onTouch"

eg. function onTouch ()

So, let's say we want the brick to turn transparent.
We'd say:

function onTouch()
brick.Transparency = 1
end
brick.Touched:connect (onTouch)



I prefer to use a method where the connection line goes first:

brick.Touched:connect(function ()
brick.Transparency = 1
end)
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
15 Jun 2013 03:03 PM
I would recommend grabbing a simple free model, such as a VIP door, and reading the script.
Read it until you understand it. If there's something, there, that you aren't familiar with and can not figure out, then feel free to either ask it here or check on http://www.wiki.roblox.com and figure it out.

http://wiki.roblox.com/index.php/Table
http://wiki.roblox.com/index.php/Variables
http://wiki.roblox.com/index.php/Function
http://wiki.roblox.com/index.php/Loops
http://wiki.roblox.com/index.php/Conditional_statement
http://wiki.roblox.com/index.php/Methods
http://wiki.roblox.com/index.php/Arguments_and_Parameters
http://wiki.roblox.com/index.php/Operators

These are some of the basics that you can use to learn what things mean, do, and are, so that you can use them to create your own things.

Another good way to assist in your learning is to check out some of the threads on this sub-forum, so you can learn from others' mistakes and successes.

The brick.Touched:connect(onTouch) would be the connection line to a function that you name 'onTouch'.
For example..

local brick = Workspace.Part
onTouch = function(h)
--stuff
end
brick.Touched:connect(onTouch)

Another example..
local brick = Workspace.Part
function onTouch(h)
--stuff
end
brick.Touched:connect(onTouch)

A third example.
local brick = Workspace.Part
brick.Touched:connect(function(h)
--stuff
end)

That third one is called an anonymous function. It doesn't have a name, and is only called through that connection line.
Report Abuse
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 03:06 PM
So would the variable be first?

To link it the function? Like the first line of the script.
Report Abuse
Wolfbain2315 is not online. Wolfbain2315
Joined: 16 Aug 2011
Total Posts: 47619
15 Jun 2013 03:10 PM
I put

function OnTouch()
brick.Transparency=1
end
brick.Touched:connect(OnTouch)

On the "Part" and nothing happened when I touched it in solo.

Do I have to be in build mode?
Report Abuse
Frostglacier is not online. Frostglacier
Joined: 28 Oct 2010
Total Posts: 4177
15 Jun 2013 03:12 PM
Have you defined "brick" as the particular part you want to change?

eg. brick = game.Workspace.speshulpotatobrick

Also, when scripting. I advise that you work in Studio/Edit mode.

That way, it's much easier to test and fix your scripts.
Report Abuse
funnymouse7 is not online. funnymouse7
Joined: 17 Mar 2011
Total Posts: 1741
15 Jun 2013 03:18 PM
you have to rach the part you dont simply say brick.Touched or whatever
heres what you do

first of all you go into game, and then you go into where the part is (eg. workspace, lighting, etc.), and then you go to the part (or model if its in one) to go to the part you must type its name properly all of this is cap sensitive so like this:

function OnTouch()
game.Workspace.Part.Transparency = 1
end

game.Workspace.Part.Touched:connect(OnTouch)
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