How to program basic roblox
How to program basic roblox
How to Program BASIC
How to Program BASIC
Genres
Description
Contents
Obtaining
This item is obtainable in the game Bee Swarm Simulator.
First, the player has to enter seven codes in the «Promocodes» section in the System menu in order to obtain 7 pronged cogs to craft the VR Goggles. These codes are «Dysentery», «Jumpstart», «Carmensandiego», «Luther», «Millie», «WordFactory» and «Troggles», and can be inputted in any order. Each time they are inputted, a clue associated with it would be given, as well as one pronged cog.
After inputting all 7 codes and obtaining the 7 pronged cogs, the player then has to craft the Strange Goggles at the Shop. You will also need 77 Honey to craft it. After crafting it, the player then has to go to the computer area to meet the Digital Bee.
The Digital Bee then will flash symbols on its screen. These are randomized for each player; the symbols used are «?, &,
After this has been completed, simply return to the computer area and the Digital Bee will create a Star Jelly, additionally giving you the item as well as a badge.
Clues
Dysentery: While travelling from east to west, this could demand urgent rest.
Jumpstart: These educational games make learning fun. Hop into them and it’s begun!
Carmensandiego: As elusive as Waldo, from Sydney to Bamako.
Luther: These clever fry make excellent sleuthers. One rhymes with Teddy, the other’s named __.
Millie: Into a cash register she mooved. Then her jellybean counting improved.
WordFactory: Where would a hare prepare the things at which you currently stare?
Troggles: Wrecking your numeric lunch, these baddies make a nasty bunch.
History
Release history
Location | Available from | Available until |
---|---|---|
In-game | November 23, 2020 | Unavailable (works for some players) |
Trivia
This section is a trivia section. Please relocate any relevant information into other sections of the article.
Tutorial:Beginner guide to scripting
Contents
Introduction
Welcome! If you’re new to scripting, you’ve come to the right place. This is a complete beginner tutorial series that will teach you the fundamentals of Roblox scripting. I know you want to start clicking on things and learning things, I want to take a minute to explain what you will and won’t learn.
Author’s Notes
Inserting a Part
Open Roblox Studio for the first time and create a Baseplate in the «New» tab, and you’ll see this big area. If you don’t see anything but that baseplate, don’t worry, you don’t have to put anything in there for now.
50% of your time is spent in the viewport. If you’re modeling or moving something around, you’ll do it here. Let’s talk about that more.
If you go down into your Explorer panel on the side, you’ll see a «Workspace» tab. This tab holds all Parts in the game. If you do not see an Explorer Window, go to the View Tab, then turn on the Explorer window. You’ll also need the Properties window.
Go back to the Home window and click Part (the button with the cube on it.) A gray brick should appear on the baseplate. To move it around, you can use the «Select» tool or the «Move» tool. You can move around the part along one dimension by pulling on one of the arrows using the Move tool.
You can also resize the part using the «Scale» Tool and rotate it using the «Rotate» tool.
Now you need to know how to insert other parts into your game, like fire. Go to the Explorer window and then find the Workspace tab. Open the arrow beside it and find the Part. Then, hover over the Part tab, click the plus sign, and insert a «Fire» object. If you cannot find it, you can use the search bar.
Congratulations, you just created your first fire part! But what about scripting? We’ll get to that right now.
Properties
In the Newbie’s Scripting Guide, you learned a had a very broad understanding of a property, which we’ll explain in more detail now. A property is a value attributed to a part that makes it look like what it is. For example, the Transparency, Size, and Position are all properties of a part. Property values are the numbers or words that are used to set a property. How do you do that? You can go to the Properties window, find the property, then type in the value.
The main properties a beginner should know are:
But how do you set a property using a script? Well.
Making Paths
You should have already have a basic idea on how to make a path if you have read the Newbie’s guide, but if you haven’t, this section will explain it briefly.
Create a part and a script into the Workspace. Delete any existing code in the script.
First we need to access the part. Start by typing «game».
The word «game» should turn blue (or red if you had dark mode enabled.) Now, access the Workspace, by typing a period, then «Workspace».
Then, access the Part. You’ll notice that the part tab has a little indent compared to the Workspace tab. We say that the Part is the Workspace’s «child,» and that the Workspace is the Part’s «parent.» In Roblox, the Explorer window is organised sort of like a hierarchy, where objects are placed on a sort of «rank.»
Of course, if you had renamed the Part, you’d need to replace «Part» with the name you gave it. Also, make sure that no two parts are given the same name: otherwise the script won’t know which part to access.
Now we set the property. We say that the property is a child of the part. So.
To set the value, type an equal sign, followed by the value. So the completed code would be.
Spaces around the equal sign is optional, but it makes the script neater. So, when you playtest the game, you’ll see that the part suddenly vanishes. In reality, it had just been made invisible by the script.
Alternatively, in the Explorer window, drag the script onto the part, if it is done correctly, it should look like this:
There are a few new terms here. When you say «script,» the game will assume it means the script the text is on. When you say Parent, instead of looking for the script’s child, it’ll access its parent.
If you had made a mistake, chances are the game will have noticed it. Go to the View Tab, then click on «Output.» A window will appear, and if the game found an error, it would print an error message nice and bold in red. Clicking on the red message will take you to the source of the problem.
Note: If you need to set a text value, place the value in quotations. Also, Color3 and BrickColor values are done differently, and I’ll need to cover that later.
An alternative way to access a child is by wrapping the name in quotations and square brackets.
Both of the above lines serve the same function. However, you must use the square brackets method if the name of the object contains spaces. (For example, if «Killbrick» was renamed to «Kill brick,» you would use the square brackets method.
Now, things will get a tad bit more complex. A «folder» is an object that can be inserted into the Workspace that holds multiple objects together as a sort of organizational tool. A «model» is another object that serves a similar function. Oftentimes developers will place models inside folders. A good rule is to start with «game,» then work your way down to the object.
You can see that this shows a more complicated hierarchy. The part is placed in a model, inside a folder, in the Workspace. Of course in these complicated situations, names such as «Folder,» «Model,» and «Part» should be renamed to prevent confusion. A good rule of thumb is that if something should be accessed in a script, it should ALWAYS be renamed.
Printing is an essential part of debugging your game. By default, the following code should already be in your script when you create one:
Now, go to the View tab on the top of the screen and click «Output.» A window should appear.
If you play your game, you will see that «Hello world!» was posted in the Output window. It has no function in a live server, but is essential should you come across a bug you can’t solve.
Variables
Now we discuss variables. Variables are, in short, placeholders for data. It would store information such as numbers and text. Then, in future use, instead of typing in those values, one can just mention the variable. Think of them like a colloquialism in the English language (for example «kinda,» «dunno,» or «ok»). These words are simply a way to informally shorten a sentence.
When we first mention a variable we are declaring it. This is how we do it:
Here, we are declaring a variable named «Var». We are also establishing that the variable var is equal to 0.
The local is optional, but it is common practice to use it always because it is faster for the system to obtain.
Note: This is case sensitive. Therefore, «var» and «Var» are two completely different variables.
There are 5 main types of variable values:
Instances
All these are instances.
An instance is an object in the Explorer. This refers to parts, light objects, and more. An example of this is the Parent property of a part.
To set an instance variable, make a path, as explained above:
Integer Values
An int value, otherwise known as an integer, is basically any number that is not a decimal. An example of this is the Brightness setting of a light object.
To set an int value, you can simply enter the number. Note that the number should turn aqua (or yellow for dark mode).
Float
A double-precision floating point format, often shortened to float, is any number that allows for decimals. Usually, they never have more than 3 decimal places. Just like int values, you can simply enter the value.
Boolean
A boolean, otherwise known as a bool value, is a value that is either true or false (yes or no). In the Properties window, the properties with a checkbox is a boolean.
Checkboxes imply booleans.
To set a boolean, enter either true or false.
Strings
A string is any text that uses letters, symbols or spaces. To enter one, you must wrap it in quotation marks.
Here, the word «Cheese» is wrapped in quotations.
Of course, there are other data types, like CFrame and Enum, but we’ll get to those later.
Nil, also known as null in other languages, is nothing; the absence of any data. Nil is not a data type in its own right, therefore variables of any data type can be set to nil. When referring to Instances, nil refers to an object that does not exist.
Accessing Variables
Now, we need to know how to use the variables. If you want to do something with a variable, just substitute the value with the variable name. What I mean is that both of these scripts yield the same results.
You can see that variables are direct substitutions. Note that if you are accessing or updating a variable, do not use local. Only use local the first time the variable is mentioned.
However, this lengthens the script, and makes it more complicated. In this case, the first script would be more convenient than the second. However, variables are mostly used when a value is mentioned more than once.
But what’s the difference between these two lines?
When you put data in strings, you need to place them in quotation marks. So, in the second line, you are telling the script to print the string, so you would see «VariableName» in the output window. In the first line, you are telling the script to print the variable, so it would print the value. However, make sure the variable name is spelled correctly, otherwise it’ll get an error.
Now what is wrong with this script?
Remember, Roblox Lua uses the same writing system as English; it is read left to right, top to bottom. Therefore, the script won’t know what «car» is until it reaches line 2. Line 1 will break.
Note that variables cannot be accessed from other scripts.
Earlier, I left you hanging on how to set color values.
BrickColor allows you to use a color from a preset list of colors that can be found here.
The above script changes the BrickColor to «Really red,» one of the colors in the list.
Color, however, is done differently, as it uses Color3. This is a data type that uses numbers, not names. There are 3 constructors for this data type, and see this tutorial if you wish to see an explanation for this constructor.
Vector3
There’s another exception to setting properties. You will notice that the Roblox place is three-dimensional. It has three values: X, Y, and Z, each for one of the dimensions. Position and Size both use three values: X, Y, and Z. To set these, we use Vector3.
To learn to set Orientation, read here.
Comments
Now, what if we don’t want to forget what each line does? It’d be such a hassle to have to read each line over and over again. So, placing 2 dashes, followed by the text, will make the script ignore the text.
In this case, the script will perform the code, before ignoring the text you wrote after.
Functions
Which brings us to the final topic of the beginner tutorial: functions! A function, like a variable, is another way to simplify code. Think of it like leaving your wallet in your pocket instead of your bag to make it easier to get. A function is a piece of code that can be used over and over again. Like variables, we declare them. We do it like this:
A few notes here:
That is a lot of points, but it will become second nature when you practice using them more often.
To make it actually work, though, we call the function. We do it just like this:
And that’s all you need to know for now! Go over to the intermediate tutorial to continue. Good day.
How to program basic roblox
In Introduction to Roblox Studio, you learned how to create and manipulate parts in Roblox Studio. It’s time to use code to make them do things.
In this project, you’ll use a script to make a platform appear and disappear. You could use this in a platforming game to span a gap, challenging players to time their jumps carefully to get to the other side.
Setting the Scene
First off, you’ll need a Part to act as the platform. Making and moving parts should be familiar to you from Introduction to Roblox Studio. You don’t need a complicated game world aside from the platform — you just need a gap that your players can’t quite jump across.
Insert a Part and give it a name like DisappearingPlatform.
Resize it so that it’s big enough for a player to jump on.
Move it so that you can reach it and jump on it when testing the game.
Set the Anchored property to true in the Properties window.
Remember that setting a part’s Anchored property to true will make it stay in place no matter what. Your platform will fall down if it’s not anchored.
Inserting a Script
Code in Roblox is written in a language called Lua and is stored and run from scripts. You can put scripts anywhere — if you put a script in a part, Roblox will run the code in the script when the part is loaded into the game.
Hover over your Part in the Explorer and click the button.
Select Script from the menu which appears — this will insert a new script into the platform. Call your new script Disappear.
Delete the default code inside.
Naming Scripts and Parts
Remember to rename parts and scripts as soon as you create them so you don’t lose track of things in the Explorer.
First Variable
It’s a good idea to start off your script by making a variable for the platform. A variable is a name associated with a value. Once a variable is created, it can be used again and again. You can change the value as needed.
The term local just means that the variable is only going to be used in this part of the script. The = sign is used to set the value of the variable.
script.Parent
script.Parent is used to find the object the script is located in. As you might have guessed, script refers to the script you’re writing in and the Parent of the script is where it’s located.
Naming Variables
Tutorial:Cookbook/Chapter 1
Terminology is a fancy word that means «a bunch of terms and definitions». In programming in general, there are multiple terms used which all mean different things. I’ll be explaining most of these terms in this tutorial, and in future tutorials they will be covered more.
Contents
Tasks
Materials
General Terminology
General Terminology refers to terms that are related to programming, but is not a term that is actually used in code.
Lua is a lightweight, robust, and simplistic programming language, and the programming language that all Roblox games use. All future tutorials will be in Lua. Lua is not very complicated compared to other languages, which is what makes Roblox a perfect tool to begin learning how to program.
C++ is Roblox’s internal language, which is integrated into Lua. It is impossible to program in C++ on Roblox directly, however C++ is integrated into Roblox in the form of instances and other data types.
Syntax
The term Syntax refers to the specific set of characters and symbols used in programming. For example, the curly brace ( < ) and other symbols play a vital role in programming.
Compiler
The compiler, also referred to as the program itself, is the machine that is running your code. Think of the compiler as the person that is reading your code and following the instructions.
Data types
In all programming languages, there are different types of information storage known as ‘data types’. This is how data is expressed. There are 7 Lua data types and a couple of C++ specific types, as well as numerous different Roblox types that will be explained later. Get familiar with these!
Lua Data types
boolean
A boolean is as simple as «yes», or «no». This or that. In programming it is expressed as ‘true’ or ‘false’.
number/double
string
In programming, a string is a message made of text. This can be any message. An example would be «Hello, world!» (notice the quotes around the string; this will be explained later.)
function
table
A table is a collection of data. Tables are very frequently used when more than one piece of data needs to be stored; for example, multiple numbers, instances, etc. This is more convenient than storing multiple different variables.
nil is a fancy way of saying there is no data. nil is equivalent to nothing; there is no data. Nil is often used to clear a variable, giving it no value.
userdata
userdata is a variable that is none of the above. All C++ data types (see below) are userdatas as they are not native (part of) Lua.
C++ Data types =
Unlike Lua data types, C++ data types are not built into Lua. They are added by Roblox, meaning that if you practice Lua elsewhere the following data types will not be present. Two undiscussed types include bool and double, as they are mentioned above.
float
A float is a type of number that is in Double-precision floating-point format format. You can read more about that at that link, but other than that it is very similar to a double.
integer/int
void is a term that is very similar to nil, in the sense that it has no value. However, unlike nil, you cannot directly set a variable/property to void. Void is the return of a function, if the function returns nothing. If a function returns nothing, it returns «void». Void is essentially equal to nil in the sense that it has no value. In normal Lua, functions that don’t return anything are stated to return nil.
Programming Terms
Programming Terms refer to terms that will be used in code. Although you might not directly type the word, you will be using them.
Variables
A variable is, simply put, a data point. It is data that is stored and can be used later. An example is asking the player a question and putting their answer into a variable where it can be used later. Variables, although they might seem lacking, are very important and will frequently appear in code.
In Lua there are 7 different types of variables. C++ contains additional types integrated into Lua. For more info, see Data types.
Condition
Programming is a set of directions to follow. At some points, the program might have to make a decision based on data provided, and from here the program can go multiple directions. This is known as a condition. A condition is a point in the code where the compiler must make a decision based on feedback from variables, properties, etc. This is represented in code by the keyword ‘if’. We will talk about conditions in a future tutorial.
Property
A property is simply a variable that is tied to an instance. Instances will be explained upon in a later tutorial.
Event
An event is something that a function can connect to, and the function will be run when the event is fired. This will also be explained in a future tutorial.
Functions/Methods
A function, or method if tied to an instance, is a block of code that has its own code to run. When a function is «called», or told to run, it will run all the code inside of it. This is useful for code that repeats itself numerous times, as the code only needs to be typed once and placed into a function.
Basic Roblox Lua Programming That Every Smart Coder Should Know
The gaming world is getting dense day-by-day, and in the same way, people are getting indulged in the creation of games. But to create games, one should have very deep knowledge about the logic and have to be specialized in a few programming languages which support the creation of games.
Basic Roblox Lua Programming enables the game developer to develop the games and showcase the code with other users, creating a team who works on a specific project. Roblox Lua provides a platform for users to test, play, and share their codes with Roblox Lua developers.
What is Basic Roblox Lua Programming?
Lua is a programming language designed for embedded use in applications. It is a cross-platform programming language because the interpreter is written in ANSI C, and it has a simple C API, which can be embedded in the applications.
Lua programming language was originated in 1993; it is an extension to a software application that enables customization. Lua follows procedural programming with basic facilities, which excludes domain-specific or complicated features. This programming language focuses on the improvement of extensibility, portability, speed, and ease-of-use. This post features all the Basic Roblox Lua Programming requirements.
History of coding in Basic Roblox Lua Programming
Roblox is a game creation system and online game platform that enables to program various games and even play the games coded by other users. Roblox’s founder is Erik Cassel and David Baszucki, they completed Roblox in 2004 and officially released in 2006. The Basic Roblox Lua Programming revolves around the original Lua language most of the time.
Roblox enables the user to create and share the game codes with other players or users, which allows sharing and gaining knowledge in the creation of games. The genre code is scripted in Lua programming language.
Setup of Roblox Studio
Setting up Roblox Studio is easy.
Minimum Requirements
Basic Roblox Lua Programming Objects
Objects are the sets of classes that you use in your code to ease the use of multiple things and their interactions. It’s essential in Basic Roblox Lua Programming to learn about objects.
Roblox Lua Programming Character Model
Strings in Basic Roblox Lua Programming
A string can be defined as a sequence of characters that can also control the character input from the form feed.
It can be initialized in three ways-:
Tables in Basic Roblox Lua Programming
Tables in Lua enables us to create data structures like dictionaries and arrays. Lua has the advantage of using associative arrays in which indexing can be done with strings and numbers, excluding the nil. You can create a table of unlimited size.
To represent a package, Lua uses a table. To access a format function, you need to access the method string.format.
Variables in Basic Roblox Lua Programming
A variable is used to provide a name to our programs’ storage area, which can be manipulated, and it is capable of holding different values, including tables and functions. A variable is composed of digits, letters, and the underscore character. A variable needs to begin with an underscore or a letter. Lua is case sensitive, so the lowercase and uppercase are treated differently.
Lua does not support variable data types, but the scope of variables is based on three types-:
Global variables– You can access these variables from any point of the code.
Local variables– These variables can be used within the scope of the declared function.
Table fields– The most extensive variable type that can store anything except nil.
Conditional Statements in Basic Roblox Lua Programming
Lua is powered with conditional statements, enabling a user to proceed with further statements if the condition results in true and skip the assigned statements if the condition results in false. There are three conditional statements supported by Lua-:
Functions
A program is divided into a various group of statements which performs their tasks individually. All the functions should be unique so that they can perform their specific tasks. There are also predefined functions like print(), which enables you to show the arguments on the screen.
There are various function parts supported in Lua-:
Loops in Basic Roblox Lua Programming
To execute a block for a required number of times, you need to define the loops that repeatedly execute the block sequentially.
There are four loops supported by Lua:
Creating a Script in Basic Roblox Lua Programming
There are three simple scripts to show the creation of scripts in Lua:
Single line script
Multi-line functional script
User Input Script
Good tutorials list
There are a few scripting which you must try with Roblox Lua as this enables to progress with logic developing and coding-:
Other Coding Articles –
Is Lua used by Roblox?
Roblox’s scripting language, which utilizes Lua’s programming languages, is termed as Roblox Lua.
Are the Lua and Roblox Lua the same?
Yes, it is almost the same. Lua is modified for Roblox to make it suitable for developing games.
Can other users access my code without permission?
No, it is not possible to see your coding unless you choose to share.