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
 

[ Content Deleted ]

Previous Thread :: Next Thread 
shadowguy25 is not online. shadowguy25
Joined: 28 Nov 2010
Total Posts: 2547
07 Jul 2011 05:18 PM
I don't really know what scripting is, I just play games and do my work and deal with groups, but never made a script, what does it do? How do you make one? I think scripting [Script] would help me make my places better!
Please reply :D
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
07 Jul 2011 05:18 PM
[ Content Deleted ]
Report Abuse
ns001111 is not online. ns001111
Joined: 15 Jan 2011
Total Posts: 2849
07 Jul 2011 05:20 PM
Scripting is Basically Another Language that Computers use.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 05:21 PM
o.o
You are a rare one. I applaud to your wanting to learn.

Scripting is the act of creating scripts to make your game interactive. There would be no guns if there was no scripting. There would be no tycoons if there was no scripting. There wouldn't even be any *useful* GUIs if there was no scripting.

There are many good tutorials for beginners, but you must first figure out how the game is set up before you can start scripting.

I've been told that DingDong727 has some good tutorials.

I may be able to get some links if you need help finding tutorials.
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
07 Jul 2011 05:21 PM
[ Content Deleted ]
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
07 Jul 2011 05:22 PM
[ Content Deleted ]
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 05:23 PM
I meant 272... Where did 727 come from...? -.-
Report Abuse
myrco919 is not online. myrco919
Joined: 12 Jun 2009
Total Posts: 13241
07 Jul 2011 05:24 PM
[ Content Deleted ]
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 05:41 PM
ARGH!

I can't find the link to a post I made a few days ago! :(
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 06:04 PM
BAM FOUND IT!




First you need to know how the game is set up. You can think of it as a tree. 'game' is the stump, and branches off into other objects (these objects are special and are called Services). Workspace, Lighting, Players are all examples of these services.

These services may be branches themselves, but they are also extended further into more branches. Here's a simple diagram:


                                     game
                                 /      |       \
                               /        |         \
                             /          |           \
                           /            |             \
                Workspace    Lighting     Players
                   /      \                                \         
             Base    Camera                        PlayerName



Different properties and methods exist in these objects. We will be using the findFirstChild method. This method is found in ALL in-game objects, and is one of the most widely used methods in RBX.Lua.

To travel through the "tree," we do something called indexing. To index, you simple add a period to the end of the name of the object. You index an object when you add the period and supply the name of another object right after.* Let's index Lighting:

game.Lighting


The object you index is called the child. In this case, Lighting is the child. The object you're indexing INTO is called the parent. In this case, game is the parent.

Here we go.


game.Players.PlayerName.Character.Humanoid.MaxHealth = math.huge
game.Players.PlayerName.Character.Humanoid.Health = math.huge


This script CAN error if one or more children are missing. This is when you'd want to use the findFirstChild method to prevent errors. You also want to utilize variables.

local player = game.Players:findFirstChild("PlayerName")
if player ~= nil then
local humanoid = player.Character:findFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.MaxHealth = math.huge
humanoid.Health = math.huge
end
end

There's a new word. nil. In Lua, nil is a reference to nothing. nil does not exist. It's somewhat of a hard concept to explain.

The if-then statement tests if a condition is true. When you assigned the 'player' variable, you used the findFirstChild method. The findFirstChild method returns the object you're looking for if it is found. If the object is not found, it returns nil. You then use the if-then statement to check to see that player is NOT nil. Here's the list of operators:

== - is equal to
~= - is not equal to
< - is less than
> - is greater than
<= - is less than or equal to
>= - is greater than or equal to

Notice you use double equal signs (==). The double equal sings are used to compare two snips of data. The single equal sign (=) is used to ASSIGN things. Please remember this.



*There are other ways to index, but it isn't necessary to know as a beginner scripter.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 06:10 PM
My apologies, I messed that post up big time...




First you need to know how the game is set up. You can think of it as a tree. 'game' is the stump, and branches off into other objects (these objects are special and are called Services). Workspace, Lighting, Players are all examples of these services.

These services may be branches themselves, but they are also extended further into more branches. Here's a simple diagram:


                                      game
                                 /      |       \
                               /        |         \
                             /          |           \
                           /            |             \
                Workspace    Lighting        Players
                   /      \                                \
             Base    Camera                        PlayerName



Different properties and methods exist in these objects. We will be using the findFirstChild method. This method is found in ALL in-game objects, and is one of the most widely used methods in RBX.Lua.

To travel through the "tree," we do something called indexing. To index, you simple add a period to the end of the name of the object. You index an object when you add the period and supply the name of another object right after.* Let's index Lighting:

game.Lighting


The object you index is called the child. In this case, Lighting is the child. The object you're indexing INTO is called the parent. In this case, game is the parent.

Here we go.


game.Players.PlayerName.Character.Humanoid.MaxHealth = math.huge
game.Players.PlayerName.Character.Humanoid.Health = math.huge


This script CAN error if one or more children are missing. This is when you'd want to use the findFirstChild method to prevent errors. You also want to utilize variables.

local player = game.Players:findFirstChild("PlayerName")
if player ~= nil then
local humanoid = player.Character:findFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.MaxHealth = math.huge
humanoid.Health = math.huge
end
end

There's a new word. nil. In Lua, nil is a reference to nothing. nil does not exist. It's somewhat of a hard concept to explain.

The if-then statement tests if a condition is true. When you assigned the 'player' variable, you used the findFirstChild method. The findFirstChild method returns the object you're looking for if it is found. If the object is not found, it returns nil. You then use the if-then statement to check to see that player is NOT nil. Here's the list of operators:

== - is equal to
~= - is not equal to
< - is less than
> - is greater than
<= - is less than or equal to
>= - is greater than or equal to

Notice you use double equal signs (==). The double equal sings are used to compare two snips of data. The single equal sign (=) is used to ASSIGN things. Please remember this.



*There are other ways to index, but it isn't necessary to know as a beginner scripter.
Report Abuse
blueymaddog is not online. blueymaddog
Joined: 23 Sep 2009
Total Posts: 5459
07 Jul 2011 06:14 PM
lol last year I started learning to script because I was curious on how epic games were made and how I could make epic games! then after a year of scripting I made an epic place! :D my lighting place!
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
07 Jul 2011 06:15 PM
@bluey

When I was going through my threads, I noticed you had asked about metatables. Do you still need help with them (after 2 years :D)?
Report Abuse
shadowguy25 is not online. shadowguy25
Joined: 28 Nov 2010
Total Posts: 2547
09 Jul 2011 10:38 AM
@Agent thanks for the help :D [?] ok...
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