Beginners Advanced Guide to Roblox

Become a Brick-smith in no time!

One way door March 12, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 1:48 pm
Tags: , , ,

Building

First, open up Roblox Studio. Create a wall. I will use a spawn room, for example.

Next is the shield. Create a brick. Color, transparency and reflectance do not matter. We will have to fill from the bottom and to the top. I recommend for it to be two studs thick and it to be anchored. Note that if your brick is only 1 stud thick, it will be possible to open it from both sides.: 

Note that there are two more studs in front of where we just placed a shield, so that we can place another brick (of the same size). Anchor this one, too. (Look near the ground where the building stands).

 

The rest you decide:

Name the bricks Door And Door2 , and group those two bricks.

Scripting

Select the brick that is supposed to open when you touch it. Click Insert, Object, then select Script

 

Go to scripting mode for that script you just inserted by selecting that script and double-clicking on it.

Here’s the script you’ll have to insert:

door = script.Parent.Parent.Door
door2 = script.Parent.Parent.Door2
function onTouched(hit)
	door.CanCollide = false
	door2.CanCollide = false
	wait(3)
	door.CanCollide = true
	door2.CanCollide = true
end

script.Parent.Touched:connect(onTouched)
 

How to make a model regenerate March 12, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 1:43 pm
Tags: , , ,

 

Copy and paste this code into the Script you just created. Replace “MyModelName” with the name of your model.

model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."

message = Instance.new("Message")
message.Text = messageText
backup = model:clone()

while true do
	wait(300) -- regenerate this model every 300 seconds

	message.Parent = game.Workspace
	model:remove()

	wait(4) -- display regen message for 4 seconds

	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()
	message.Parent = nil
end

Save and Exit

Since scripts are constantly running, changes to them do not take effect until you exit and reload a level OR cut the script and paste it back (using the explorer tab). You should now see your model regenerating every 5 minutes.

Regeneration Buttons

To create a regeneration button, create a script, place it in the button, and copy this code into the script:

model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."

message = Instance.new("Message")
message.Text = messageText
backup = model:clone()
enabled = true

function regenerate()
	message.Parent = game.Workspace
	model:remove()

	wait(4) -- display regen message for 4 seconds

	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()
	message.Parent = nil

	enabled = false
	wait(30)
	enabled = true
end

function onHit(hit)
	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
		regenerate()
	end
end

script.Parent.Touched:connect(onHit)

Change “MyModelName” to the name of the model you want to regenerate, and you’re done.

playGood luck!

 

How to add checkpoints March 12, 2009

Filed under: Beginners Guide to RPG making — pokemonfan143 @ 1:39 pm
Tags: ,

1. Open your place in Roblox Studio.

 

The Tools button

The Tools button

2. Click “Tools” in the upper left hand corner of the screen, (to the left of “Insert”, “Fullscreen” and “Help”.)
3. Select “Game Objects” from the pulldown menu.

 

Insert a spawn location

Insert a spawn location

4. Insert a spawn location from the toolbox. This is a small, flat, colored box with spider-like design on it.

 

The "AllowTeamChangeOnHit" checkbox

The “AllowTeamChangeOnHit” checkbox

5. In the Explorer pane, click on your spawn location, then click the “AllowTeamChangeOn” box.

 

The AutoAssignable checkbox. This makes people be assigned to a team when they join.

The AutoAssignable checkbox. This makes people be assigned to a team when they join.

6. In the Explorer pane, click on your team, and you will see various properties of your checkpoint such as team name and color. Check “AutoAssignable” if you want people to spawn at your checkpoint. Check “AutoColorCharacter” if you want people to change colors when they hit your checkpoint.
7. You may also want a leaderboard that shows which checkpoint people have reached. The leaderboard is the parchment paper icon in “Game Objects”. (Mouse over the 2 pieces of paper to see which one says “leaderboard”. Select this one to insert into the game)

 

Flicker script(makes things holographic) March 12, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 1:15 pm
Tags: , , ,

wait(0.01)

script.Parent.Transparency = 0.5

 

wait(2)

script.Parent.Transparency = 0.8

 

wait(0.01)

script.Parent.Transparency = 0.5

 

wait(0.01)

script.Parent.Transparency = 0.8

 

wait(0.01)

script.Parent.Transparency = 0.5

 

wait(1)

script.Parent.Transparency = 0.8

 

wait(0.01)

script.Parent.Transparency = 0.5

 

wait(2)

script.Parent.Transparency = 0.8

 

wait(0.01)

script.Parent.Transparency = 0.5

 

wait(0.01)

script.Parent.Transparency = 0.8

 

end

 

How do fountains work? March 11, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 1:15 pm
Tags: , , ,

 

Design and Build the Fountain

Design and build the fountain structure in your place. Make sure all the bricks are anchored, so the water droplets don’t move them accidentally. You may use any surface type for your fountain, since all the pieces will be anchored. Identify the top most brick in the fountain structure, for this will be the brick that will shoot out the water droplets.

Basic Script

The script consists mainly of a while loop that creates a new water drop every frame. The while loop will include a short delay (maybe 0.5 or 0.3 seconds) to space out the drops.

In each loop, the script will create a new water drop using a simple Instance.new(“Part”). You will set the correct properties to make it look like a round, blue drop – such as setting the color, transparency, and shape. Note that by setting the CFrame of the droplets to the tip brick of the fountain, the droplet will appear to come out of the top of the fountain. In Roblox the part will automatically be moved up to a clear spot. To shoot the drop out of the fountain, you will set it’s y velocity property to your desired speed. To change the direction that the drop shoots out in, you can change the x and z values of the Velocity property to random numbers. You may also play with the RotVelocity properties of the drop.

Select the tip brick of your fountain, and insert a blank script. The code for the basic script is below; copy and paste it into your new script.

Example

This is an example, to be inserted into an anchored brick.

local lifetime = 20

while true do
	wait(.1)
	local pos = script.Parent
	local b = Instance.new("Part")	

	b.Position = pos.Position + pos.CFrame.lookVector
	b.Size = Vector3.new(1, 1, 1)
	b.Shape = 0
        b.BrickColor=BrickColor.new("Bright blue")
	b.Transparency = 0.3
	b.TopSurface = "Smooth"
	b.BottomSurface = "Smooth"
	b.CanCollide = true
	b.Parent = game.Workspace
	b.Velocity = Vector3.new(1, 75, 1)
	game:GetService("Debris"):AddItem(b, lifetime)
end

Cleaning up the drops

You have a design option here. You can set CanCollide to false on the drops so they  will sink through the bottom of anything it touches, like its being absorbed. This  works best if there is nothing hanging over it. You can also add the newly created drop to the Debris Service , as in the sample  script above. You can say how long the droplet will exist by specifying the number  of seconds in the 'lifetime' variable. The Debris service will remove items added to it after the specified number of seconds. A third option is to set a maximum number of drops that can exist at any point in  time. After setting up the drops, make them a parent of a blank model (which will  hold the newly created drops) and which is in turn a parent of the spout. Then, in the loop, count the children of the blank  model and if over 10 or 20 or a number of your choice delete the first child. This  way the oldest drop will be deleted before a new one. You calculate the life time of  each drop. For instance, with a 0.5 second delay on the loop and a 30 count limit on  the drops you can determine that one drop will stay in game for 15 seconds (life = count*delay)! You have a further option of attaching a script to the drop that will slowly delete  it after 1 or so seconds of being touched. The sample code below shows you how to implement this cleanup choice.
bin = script.Parent

function onTouched(part)
	part.BrickColor = BrickColor.new(26)
	wait(.3)
	part.Transparency = .2
	wait(.1)
	part.Transparency = .4
	wait(.1)
	part.Transparency = .6
	wait(.1)
	part.Transparency = .8
	wait(.1)
	part.Parent = nil
end

connection = bin.Touched:connect(onTouched)

Cleaning up the drops your fountain creates will free up memory, keep the drops to a limit, 

and will greatly speed up game play.

fountainGood luck!

 

How To Make Glow Scripts March 11, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 1:12 pm
Tags: , , ,

 

The Reflectance Glow

First, insert a brick, in Roblox Studio, then Insert a script inside this brick. Open up the script, then delete the text that says “Hello World!”. Then, add the following text:

while true do
	for i=1, 9, 1 do
		-- Go up
		script.Parent.Reflectance = i * .1
		wait(.1)
	end
	for i=9, 1, -1 do
		-- Go down
		script.Parent.Reflectance = i * .1
		wait(.1)
	end
end

Loops

for i=1, 9, 1 do
     script.Parent.Reflectance = i * .1
     wait(.1)
end

"i=1" means that the script is making a variable, which is, a value that can change as the script progresses.

In this case, "i" will start at 1, and will increase everytime the "for loop" loops. It will go to 9 

(notice the next statement, ", 9"), increasing in units of 1 (or, as in the second loop, decreasing by 1) 

and then stop the loop.

script.Parent.Reflectance = i * .1

This is just setting a value, but with a catch: we're setting it to a variable. Variables are assigned numerical values. 

(Note the "* .1". That's to make it ".1" when i is 1, and ".4" when i is 4, for example. 

A decimal is just another way to write a fraction.
This is how the loop can be reversed:

	for i=9, 1, -1 do
		-- Go down
		script.Parent.Reflectance = i * .1
		wait(.1)
	end

The loop goes from the value of 9 to the value of 1, decreasing in units of 1 each time.

Ushanka hatGood luck!

 

How to make text on a brick March 11, 2009

Starting it up

Open Roblox Studio. Then click on the blank paper button in your toolbar. That will open up a new place. Editing a place in Roblox Studio is a lot easier than editing a place in “Play Solo”. You can move your camera freely in Roblox Studio while you need to get past obstacles in “Play Solo”.

Steps

1. Go to insert in your toolbar and select Object… “Model”.

2a. Click the insert button on the grey toolbar and click on any brick. It should currently be named “Smooth Block Model”.

2b. (Optional). Now make the brick a 5x1x5, or any other reasonable length, width, or height. If you want to make the brick a step-on, I’d sugguest the size to be 3 or less.

3.In Explorer, drag the brick and put it in Model. Once you’ve done that, rename name the “Smooth Block Model” brick “Head”. Spelling and captilzation needs to be correct when spelling Head.

4.Now go to Insert in the toolbar and select Object. Select Humanoid or type in “Humanoid”. Spelling and capitalization needs to be correct for that too. Now using Explorer, drag the humanoid into Model. Note: if you have “Head” selected while looking for “Humanoid”, you won’t find it. Click “Model” once, then look in Insert/Object for Humanoid.

 

Script to change words

If you want the brick to say (for example) “Hi!” *waits* “What’s your name?” *waits* “Me too!” *waits* Then insert this script into the head or torso.

 

while true do

script.Parent.Parent.Name = "Insert text 1 here." -- Change my text to your text.
wait(1) -- Change the time in between changing from the current text to the next text.
script.Parent.Parent.Name = "Insert text 2 here." -- Change my text to your text.
wait(1) -- Change the time in between changing from the current text to the next text.
--If you want it to have more text looping, copy the script.Parent.Parent.Name = "..." and the wait() lines.
--Then change to your prefernce.
end

And there you go! You have now put text into your brick with a script.

mining helmetGood luck!

 

How to make a Trampoline March 11, 2009

Filed under: Begginners Guide to advanced scripting — pokemonfan143 @ 12:58 pm
Tags: , , ,

Setup

Let’s begin by adding one brick. Now, you’ll want to look in your properties, and if you don’t have the properties window, then select View->Properties.

Script

  • Select the brick.
  • Insert > Object > Script.
  • Copy and Paste the following into the script object:
local v = 200
function onTouched(part) -- when the brick gets touched
	if part.Parent ~= nil then -- if it's human
		local h = part.Parent:findFirstChild("Humanoid") 
			if h~=nil then 

h.Parent.Torso.Velocity=Vector3.new(0,v,0) -- shoot your humanoid in the air at v speed
wait(0.5) -- wait this long						
			end
	end
end
script.Parent.Touched:connect(onTouched)

This script was taken right from the trampoline model. If you want to change how fast you go, chang the variable V. The problem with this is that if you make your entire trampoline with this script, the trampoline will bounce equally high in the middle as on the outer edge. This isn’t representative of real life. So, what you can do is make the trampoline bricks in the middle bounce a little higher (the ‘sweet spot’) than on the outer edges to make it a little more realistic.

 

How to Make Conveyor Belts March 11, 2009

Filed under: Begginners Guide to advanced building — pokemonfan143 @ 12:54 pm
Tags: , , , , ,

 

Create The Brick

Edit your place using Roblox Studio. You will need the additional features available from Roblox Studio to build the conveyor belt. If you are in Edit mode, click the menu on the top left called Tools to open up the Roblox Studio features.

From the menu, click Insert and select Object. From the pop up window, select Part – which will insert a brick into your place. Click the Zoom Extents button on the top button bar if you cannot find the new brick. This will center your screen on the brick.

Select the brick using the Resize button, and stretch it out to the size you want the conveyor belt to be. While the brick is selected, change the brick property called “TopSurface” to “Smooth” – so that the items being moved will not get stuck on the belt. If you don’t have the Property window open, click View from the menu bar, and select Properties to open it.

You can change the color of the brick to your choice.

The last change is to set the Anchored property of the brick to checked. In the Property Window, find the property Anchored and check it.

Turn the Conveyor Belt On

The Velocity property of a brick describes the speed and direction of an object. It has 3 values – one for each x, y and z axis. These values refer to the directions of the workspace – not of your brick.

To change the velocity property, select the brick and open the Properties window. Click the [+] sign to expand the Velocity property and show the values for each axis. The x value will move the bricks along the x-axis of the workspace. The y value will try to move the bricks vertically along the y axis. The z value will move it along the z-axis of the workspace. Since it is hard to tell which is the x-axis and which is the z-axis, try entering a value of 5 on the x-axis – and test the brick in Play Solo mode by clicking Tools > Test > Play Solo. You can add a value to more than one axis which will change the angle of the motion. Negative numbers apply the same amount of force as positive numbers, but in the opposite direction.

For this example, set the x value of the Velocity property to 5.

 

Making a Flowing River

Rivers are simply colored conveyor belts – which have a transparent brick above the conveyor belt to make it look like water.

To make a river, follow the steps described above for how to create a Conveyor belt. Then continue with these steps to make it act like a rushing river.

  • Change the BrickColor property of the conveyor belt to Bright blue.
  • Make sure that brick is solid; it has the Transparency property set to 0.
  • Copy and paste the conveyor belt brick, and make sure they are right on top of each other.
  • Change the CanCollide property of the top brick to unchecked, so that players will be able to walk through this top brick.
  • Change the Transparency property to 0.5 – so it looks like water you can see through.
  • Make sure the Anchored box is checked on this piece, too.
  • Set the Velocity property to 0 for all the axes of this top brick. Only the bottom brick will move objects. All objects that land on top of the ‘water’ brick will sink down to the conveyor brick.
  • Finally, group the bottom and top together.

Now we have to test it. Go to Tools > Test > Play Solo. You should get another window where you’re playing solo. Go to your river, and step on it. If it isn’t flowing the right way, then go back to studio and set the Velocity value to a different axis (either x or z axes.) Test it again to make sure the water is flowing in the right direction.

Making a Whirlpool

Instead of using the Velocity property to move items in one direction, you can use the RotVelocity property to make the conveyor belt move objects around in a circle.

Follow the steps describing how to create a conveyor belt and ‘Making a Flowing River’. Then complete these steps:

  • Remove the values from the Velocity property.
  • Expand the RotVelocity property to show the values for the 3 axis.
  • Add a 5 to the x-axis property, and a 5 to the z-axis property.
  • Add walls around the river – to keep the pieces inside.
  • Test the whirlpool in Play Solo mode. Bricks that are placed on the river will begin to move in a circular fashion.

 

AntlersGood luck!

 

Brick Surface Types March 11, 2009

Filed under: Begginners Guide to advanced building — pokemonfan143 @ 12:51 pm
Tags: , , ,

Smooth

A smooth surface will not form a bond with anything. That means that it will slide, fall, break and move without much force. <needs correct force value>

Glue

Glue can be found on the various chassis that are available in the Toolbox. It forms a very loose bond with whatever is in contact with it, enough to slow a ball, or to keep a player on a vehicle while it is moving. <needs correct force value required for movement>

Welds

Welds form a very secure bond with whatever they are touching. If two surfaces that are in contact are welded, then it takes a good bit of force to move them, a large bomb at least. <needs correct force values required for movement>

Studs

Studs are one of the three types of surfaces a new brick starts out with. It connects to an inlet to form a semi-secure bond <needs correct amount of force to break bond> that can be broken fairly easy, but can hold against any slingshot attacks.

Inlets

Inlets connect to studs, and form a secure connection that can withstand anything short of a rocket or bomb.

Special Surfaces

Hinges

These little pegs allow for movement of whatever is attached to them in accordance with the physics of the Place and the movement confined to a 360 degree angle around the connection to the hinge. Use these for rotating objects, any type of ramp, or doors.

Motors

These are a bit more complicated things to describe.

Motors apply a force to anything that is connected to them by a certain amount of impulse that is described in the configuration panel. The force power can be set and the trigger set in a Lua script or in the configure panel for the motor. The trigger can be set to one of 6 things:

  • A user hit key.
  • The set of secondary controls (the UJHK keys)
  • The Primary controls (WSAD keys)
  • An event in the world (such as the destruction of a door, or the movement of a player into a certain area.)
  • A basic AI that can be set to the motor set, such as telling the motors to attack a player, or to run away.
  • Constantly be on, such as the spinning bar in Crossroads.

These have to be scripted to the motor, but in the configuration panel, many of these more basic settings can be configured.

 

 
Follow

Get every new post delivered to your Inbox.