|
| 23 Jun 2016 12:00 PM |
| I have lots of game ideas, and I can build, but I have one obstacle that prevents me from making a cool game, that may or may not gain popularity. I need to learn how to script. I want to learn how to script, and if you are a good scripter who is willing to teach me or know someone who is willing to teach me, then I would be very thankful. I really enjoy ROBLOX but recently it has become boring to me because I cannot figure out how to script. I am going to start working on an obby, and I would really enjoy learning how to script so I can add to it. |
|
|
| Report Abuse |
|
|
Zleezy
|
  |
| Joined: 14 Sep 2013 |
| Total Posts: 5094 |
|
|
| 23 Jun 2016 12:04 PM |
http://wiki.roblox.com/index.php?title=Intro_to_Scripting
All starts here
Too weird for your tastes? |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:07 PM |
----------------------------------FUNCTION---------------- function Script() print("Hello Friends!") end
Script() ------------------------------------ Here's a function, you can use them to hold inactive code that you may want to use later, the "Script" is where you put the name, where it says "function" that's just defining what it is, and the end, ends the code, what's inside the function is what matters, so here's an example
function Pull() Human.Arm.Grab = true Human.Arm.Rotation = Human.Arm.Rotation - 10 end
if Human.Hand touches Rope then Pull() end
#code Instance.new("YourGirl", MyDMs); |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:11 PM |
x = 5
This is a global variable, you can use it anywhere in the script.
local x = 5;
This is a local variable, You can use it wherever it's ran, and if it is at the top of a script you can use it anywhere, notice the ; is optional.
local str = "String"; local str2 = 'String';
You can use ""'s or '''s to define strings.
print(str)
This is a function, the print function prints to the console, VarOfTheFunction(Arguments) Arguments are passed down to whatever is in the function.
print(str, str2)
As you can see functions can have multiple arguments, you can even save the function in another variable!.
NewPrint = print; NewPrint(5); print = nil; print(5);
The newprint will error, but the print(5) won't. nil basically means Null/doesn't exist/ not defined.
local x; -- Makes a undefined variable, nil, these two --'s are what makes comments, code that isn't ran :D. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:14 PM |
There's ALOT ALOT ALOT ALOT more things btw.
lua.org
I usually don't teach people so don't expect me to teach you.
I was boredish.
that's about 1% of the language btw. |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:15 PM |
----------------------------------IF STATEMENTS---------------- x=15 if x==15 then print("x equals 15") else if x~=15 then print("x does not equal 15") end end ------------------------------------ We first defined what 'x' is equal to then made an if statement, when asking the script if something equals something else, we always use double equal signs, and if we're asking if something doesn't equal something else, we use the squiggly and the equal sign, I think you can understand if statements without me telling you, it's closer to human logic than anything else
= equals == is equal to ~= does not equal
#code Instance.new("YourGirl", MyDMs); |
|
|
| Report Abuse |
|
|
jmt99
|
  |
| Joined: 27 Jul 2008 |
| Total Posts: 4799 |
|
|
| 23 Jun 2016 12:18 PM |
you guys are kinda bad at teaching. this person is probably completely illiterate in scripting, you guys need to explain what all these things you are saying are.
@OP
look up roblox scripting tutorials on youtube. they are visual and pretty helpful and easy to understand.
|
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:20 PM |
dont forget the output and printing they're both very useful in diagnosing problem(s) in your script usually you can look up the errors online and you'll most likely find a solution
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2016 12:26 PM |
----------------------------------ROBLOX STUDIO SCRIPTING---------------- game.Workspace.Baseplate.Transparency = 1 ------------------------------------ So, you know the Explorer panel with the Workspace, the Lighting, Players, StarterGui, StarterPack, well we call that structure a DataModel, and all of these are connected to the game, when scripting we use a period "." to connect things in the DataModel, we also use "Parent" and "Child" to define in something is in something else or not, so let's say you put a script inside of a brick, well the brick is the parent and the script is the child, or if you put a brick in Workspace, the Workspace would be the parent and the brick would be the child, so let's say you have a script inside a script inside a script inside a script, well that would be a child inside a parent inside a parent inside a parent, well we can change things in the DataModel with scripting, so lets say there's a brick in Workspace and we wanted to put it in Lighting, we could say
game.Workspace.Brick.Parent = game.Lighting
Now, you know the Properties panel? where they have everything that defines what the selected object is that you've clicked on in the Explorer panel, like if you select a brick it will say Name, the Transparency, CanCollide, Color, Anchored, well we can change those as well
game.Workspace.Brick.Name = "CoolBrick"
Or lets say we wanted to make a brick walk through, we could say
game.Workspace.Brick.CanCollide = false
But sometimes it's a lot to type so we can make varibles for things in the DataModel, so we can say
Brick = game.Workspace.Brick Brick.Name = "EpicBrick"
or
Light = game.Lighting Light.Brightness = 99999999
#code Instance.new("YourGirl", MyDMs); |
|
|
| Report Abuse |
|
|