Lua Help: Difference between revisions

1,099 bytes removed ,  30 October 2023
Link the DHTML page here!
>JulienDethurens
No edit summary
(Link the DHTML page here!)
 
(45 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<noinclude>__NOTOC__ {{clear floats}}</noinclude>
<noinclude>__NOTOC__ {{clear floats}}</noinclude>
{{TitledBox/start|heading=<noinclude>{{CatUp|Main Page}}</noinclude>{{CatItem|luaCode.png|Lua Help|Roblox Lua|Making your maps do crazy things}}}}
{{TitledBox/start|heading=<noinclude>{{CatUp|Main Page}}</noinclude>{{CatItem|luaCode.png|Lua Help|Roblox Lua|Making your maps do crazy things}}}}
[http://www.lua.org Lua] ('''not''' "LUA") is a simple programming language that is used in Roblox to add in customized content, like cars that drive, new weapons, etc.
[http://www.lua.org Lua] ([http://www.lua.org/about.html#name '''not''' "LUA"]) is a simple programming language that is used in Roblox to add in customized content, like cars that drive, weapons, planes, random terrain, and whole games, and much more!


This <noinclude>page</noinclude><includeonly>section</includeonly> provides tutorials to help users to learn Lua.
This <noinclude>page</noinclude><includeonly>section</includeonly> provides tutorials to help users to learn Lua.
Line 7: Line 7:
There are often multiple tutorials on the same subject, so if you don't understand something in one of them, try another!
There are often multiple tutorials on the same subject, so if you don't understand something in one of them, try another!


If you still don't understand something, you can ask at [http://www.roblox.com/Forum/ShowForum.aspx?ForumID=20 Scripting Helpers]. Note that you're more likely to get an answer if you ask a specific question than something general, and that if you have a problem with a piece of code, posting the code really helps people to find what the problem is. Posts just asking "How do I script?" or "Make me this" are usually ignored.
If you still don't understand something, you can ask in [https://discord.gg/CHFK7eXXMY the Roblox Client Search Discord server] or [https://discord.gg/Jfrdmx3ZwQ the Novetus launcher Discord server]. Note that you're more likely to get an answer if you ask a specific question, and that if you have a problem with a piece of code, posting the code (using [https://www.wikihow.com/Format-Text-as-Code-in-Discord multi-line formatting]) really helps people to find what the problem is. Messages just asking "How do I script?" or "Make me this" are usually ignored.


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Introduction series - read these first!</b>}}
{{TitledBox/subheading|Introduction series - read these first!}}
{{CatList|Script Creation Walkthrough|Script Creation Walkthrough|Creating and running scripts.}}
{{CatList|Script Creation Walkthrough|Script Creation Walkthrough|Creating and running scripts.}}
{{CatList|Flowcharts|Flowcharts|Using diagrams to show the "flow" of a script.}}
{{CatList|Flowcharts|Flowcharts|Using diagrams to show the "flow" of a script.}}
Line 15: Line 15:
{{CatList|String|Strings|Working with text in a script.}}
{{CatList|String|Strings|Working with text in a script.}}
{{CatList|Bool|Booleans|Working with yes/no values in a script.}}
{{CatList|Bool|Booleans|Working with yes/no values in a script.}}
{{CatList|Variables|Variables|}}
{{CatList|Variables|Variables|How to hold data in a static reference.}}
{{CatList|Conditional statements|Conditional Statements|Making scripts do different things in different situations.}}
{{CatList|Conditional statements|Conditional Statements|Making scripts do different things in different situations.}}
{{CatList|Loops|Loops|Making a piece of code run multple times.}}
{{CatList|Loops|Loops|Making a piece of code run multiple times.}}
{{CatList|Functions|Functions|}}
{{CatList|Functions|Functions|Wrapping code in a useful function to be called upon later in a script.}}
{{CatList|Tables|Tables|Storing multiple objects in one.}}
{{CatList|Tables|Tables|Storing multiple objects in one.}}
{{CatList|Generic for|Generic for|Using a loop to iterate through a table.}}
{{CatList|Generic for|Generic for|Using a loop to iterate through a table.}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Other Guides</b>}}
{{TitledBox/subheading|Other Guides}}
{{CatList|Absolute beginner's guide to scripting|Beginner's Guide to Scripting|If you've never worked with scripting before, look here.}}
{{CatList|Absolute beginner's guide to scripting|Beginner's Guide to Scripting|If you've never worked with scripting before, look here.}}
{{CatList|Basic Scripting|Basic Scripting|Shows you some of the basics of scripting.}}
{{CatList|Basic Scripting|Basic Scripting|Shows you some of the basics of scripting.}}
{{CatList|How to Script Anything|How to Script Anything|What it says.}}
{{CatList|How to Script Anything|How to Script Anything|Learn the basic methods to put together any script.}}
{{CatList|In-Depth Scripting Guide|In-Depth Scripting Guide|}}
{{CatList|In-Depth Scripting Guide|In-Depth Scripting Guide|More ways to understand the dynamics of Lua.}}
{{CatListUrl|http://www.lua.org/pil|Programming In Lua|Guide to Lua by its creators. (partly out of date)}}
{{CatListUrl|http://www.lua.org/pil|Programming In Lua|Guide to Lua by its creators. (partly out of date)}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Introductions to Concepts</b>}}
{{TitledBox/subheading|Introductions to Concepts}}
{{CatList|DHTML|Using DHTML|Example of DHTML, a 2007 feature letting you display webpages during gameplay (before GUI was added in 2009).}}
{{CatList|Beginner's GUI Tutorial|What are GUIs?|This very in-depth guide explains what GUIs are.}}
{{CatList|Beginner's GUI Tutorial|What are GUIs?|This very in-depth guide explains what GUIs are.}}
{{CatList|Introduction to Weapons|Intro to Weapons|An intro into the scripting of Weapons in Roblox.}}
{{CatList|Introduction to Weapons|Intro to Weapons|An intro into the scripting of Weapons in Roblox.}}
{{CatList|ROBLOX Scripting How To: Data Persistence|ROBLOX Scripting How To: Data Persistence|}}
{{CatList|ROBLOX Scripting How To: Data Persistence|ROBLOX Scripting How To: Data Persistence|What is data persistence?}}
{{CatList|Data Persistence Tutorial|Data Persistence Tutorial|A tutorial on understanding and using data persistence in your places.}}
{{CatList|Data Persistence Tutorial|Data Persistence Tutorial|A tutorial on understanding and using data persistence in your places.}}
{{CatList|How To Increase and Decrease Vector3 Values|Using Vector3 Values|Shows how to use math with Vector3s.}}
{{CatList|How To Increase and Decrease Vector3 Values|Using Vector3 Values|Shows how to use math with Vector3s.}}
Line 40: Line 41:
{{CatList|Tools|Using Tools|Creating your own tools.}}
{{CatList|Tools|Using Tools|Creating your own tools.}}
{{CatList|HopperBins|Using HopperBins|The older version of tools, HopperBins.}}
{{CatList|HopperBins|Using HopperBins|The older version of tools, HopperBins.}}
{{CatList|String Patterns|Using String Patterns|What string patterns are and how to use them.}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Reference</b>}}
{{TitledBox/subheading|Reference}}
{{CatList|Scripting|Scripting|}}
{{CatList|Scripting|Scripting|An overview of scripting in Roblox, and a portal for in-depth articles.}}
{{CatList|Function Dump|Functions|A list of all the global functions.}}
{{CatList|Function Dump|Functions|A list of all the global functions.}}
{{CatList|Class Reference|Class Reference|All the types of Roblox [[RBX.lua.Instance (Object)|Instances]].}}
{{CatList|Class Reference|Class Reference|All the types of Roblox [[RBX.lua.Instance (Object)|Instances]].}}
{{CatListUrl|http://www.lua.org/manual/5.1|Lua 5.1 Reference Manual|Official definition of the Lua language. (some features not available in Roblox)}}
{{CatListUrl|http://www.lua.org/manual/5.1|Lua 5.1 Reference Manual|Official definition of the Lua language. (some features not available in Roblox)}}


{{TitledBox/subheading|<b style{{=}}"font-size:1.25em;">Example Scripts</b>}}
{{TitledBox/subheading|Example Scripts}}
{{CatList|Cookbook|Cookbook|Large list of small example scripts}}
{{CatList|Cookbook|Cookbook|Large list of small example scripts}}
{{CatList|How do I create a brick?|Creating a Brick|Basic tutorial on creating a brick using a script.}}
{{CatList|How do I create a brick?|Creating a Brick|Basic tutorial on creating a brick using a script.}}
{{CatList|Debounce|IS:What is Debounce?|Explains what a debounce is, and what it's used for.}}
{{CatList|Debounce|IS:What is Debounce?|Explains what a debounce is, and what it's used for.}}
{{CatList|Intro to Scripting: Make a Healing Potion|Making a Healing Potion|The Intro to Scripting series, how to Heal or Damage a Humanoid.}}
{{CatList|Restricted Doors|Creating Restricted Doors|Shows how to create a door that only certain people can enter.}}
{{CatList|Intro to Scripting: Make a Dance Floor|Make a Dance Floor|Changing the color of a brick, and create simple loops.}}
{{CatList|Intro to Scripting: Make an Invisibility Tool|Make an Invisibility Tool|Shows how to create Tools and turn yourself invisible.}}
{{CatList|How do I make VIP doors?|How to Create VIP Doors|Shows how to use tables, and to create a door that only certain people can enter.}}
{{CatList|How to make precipitation|How to Make Rain|Creating drops falling from the sky in random locations.}}
{{CatList|One Way Shields|One-way Doors|How to create doors that go only one direction.}}
{{CatList|One Way Shields|One-way Doors|How to create doors that go only one direction.}}
{{CatList|How To Make Glow Scripts|Making Glow Scripts|Making objects glow, with more complex loops.}}
{{CatList|Teleportation|How to Teleport|An overview of teleportation of players.}}
{{CatList|Teleportation|How to Teleport|An overview of teleportation of players.}}
{{CatList|Making an onClicked script|Making an OnClicked Script|Shows how to use the Mouse to trigger weapons.}}
{{CatList|Making an onClicked script|Making an OnClicked Script|Shows how to use the Mouse to trigger weapons.}}
{{CatList|How to Make a Model Regenerate|How to Make Regenerating Models|Shows how to use variables to remove and create new models, even if they've been destroyed.}}
{{CatList|Sounds|Using Sounds|Shows how to use events and work with Sounds.}}
{{CatList|Sounds|Using Sounds|Shows how to use events and work with Sounds.}}
{{CatList|How to add messages|How to Add Messages to Your Place|Shows how to use scripts to work with the [[RBX.lua.Message (Object)|Message]] object.}}
{{CatList|How to add messages|How to Add Messages to Your Place|Shows how to use scripts to work with the [[RBX.lua.Message (Object)|Message]] object.}}
{{CatList|How To Use BodyPosition|Using BodyPosition|Details how to use the [[RBX.lua.BodyPosition (Object)|BodyPosition]] object.}}
{{CatList|How To Use BodyPosition|Using BodyPosition|Details how to use the [[RBX.lua.BodyPosition (Object)|BodyPosition]] object.}}
{{CatList|How To Build A Catapult|How to Build a Catapult|A guide for medieval mayhem.}}
{{CatList|PlayerAdded|Using PlayerAdded|How to use the [[PlayerAdded (Event)|PlayerAdded]] event.}}
{{CatList|PlayerAdded|Using PlayerAdded|How to use the [[PlayerAdded (Event)|PlayerAdded]] event.}}
{{CatList|Using the Chatted Event|How to Create Talking Commands|A guide on how to use the Chatted event.}}
{{CatList|Using the Chatted Event|How to Create Talking Commands|A guide on how to use the Chatted event.}}
{{CatList|How To Make an Elevator|How to Make an Elevator|How to make bricks move up and down in time.}}
{{CatList|How Do I Make Morphs?|How to Make Morphs|Creating Morphs for your players.}}
{{CatList|How To Make Multi Handles|How to Make Multi-Handle tools|Creating tools with more than one brick for a handle.}}
{{CatList|How To Make Multi Handles|How to Make Multi-Handle tools|Creating tools with more than one brick for a handle.}}
{{CatList|Money/Shop Scripts|Money and Shop Scripts|How to create an economy for your place.}}
{{CatList|How to Create a Black Hole|Creating Black Holes|Shows how to simulate gravity fields in lots of objects.}}
{{CatList|How to make text on a brick|How to make text on a brick|How to make words appear above a brick.}}
{{CatList|How to make text on a brick|How to make text on a brick|How to make words appear above a brick.}}
{{CatList|Teleportation|Teleportation|How to move characters to different positions.}}
{{CatList|How to Make Weapon Giving Teleporters|How to Make Weapon Giving Teleporters|Moving characters and giving them weapons.}}
{{CatList|How to Make Conveyor Belts|How to Make Conveyor Belts|Parts that move other parts.}}
{{CatList|How to Make Conveyor Belts|How to Make Conveyor Belts|Parts that move other parts.}}
{{CatList|How to Make Ramps|How to Make Ramps|Using [[CFrame]] to rotate parts.}}
{{CatList|How to Make Ramps|How to Make Ramps|Using [[CFrame]] to rotate parts.}}
{{CatList|How to make lava|How to Make Lava|Parts that hurt characters when touched.}}
{{CatList|Terrain_Generation|Terrain Generation|Generating non-random terrain mathematically.}}
{{CatList|How to make circles|How to Make Circles|Using [[CFrame]] to arrange parts in a circle.}}
{{CatList|Random_terrain|Random Terrain|Generating unique terrain randomly.}}
{{CatList|How to make a spiral staircase|How to Make a Spiral Staircase|Using [[CFrame]] to arrange parts in a spiral.}}
{{TitledBox/end}}
{{TitledBox/end}}