← All guides
Guide 2

Build your first tycoon

A dropper makes cubes, a conveyor carries them, a collector turns them into cash, and a button buys a second dropper.

Free60 minutes · Beginner · Roblox Studio
1
Step 1 / 9

Set up the place

  1. Open Roblox Studio, click New Experience and choose the Baseplate template.
  2. In Explorer hover over Workspace, click + and add a Folder. Name it Tycoon.
  3. Everything you build in this guide goes into that folder. It keeps Explorer tidy.

More detail

  • The Baseplate template is in the list of templates on the start screen.
  • When you click +, a list opens. Type the word Folder to find it quickly, then click it.
  • To rename the folder, click it once, press F2, type Tycoon and press Enter.
  • On a Mac, use the Cmd key every time this guide says Ctrl.
Tip. Rename every part right after you create it. Scripts find parts by name, so a part that is still called Part will not work.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

2
Step 2 / 9

Give every player cash

  1. Hover over ServerScriptService, click + and add a Script. Name it Leaderstats.
  2. Delete the line that is already there and paste this code.
  3. Press Play. Your name appears in the player list with Cash 0 next to it.
ServerScriptService > Leaderstats
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local stats = Instance.new("Folder")
	stats.Name = "leaderstats"
	stats.Parent = player

	local cash = Instance.new("IntValue")
	cash.Name = "Cash"
	cash.Value = 0
	cash.Parent = stats
end)

What each part does

  • PlayerAdded runs once for every player who joins.
  • A folder named leaderstats is special. Roblox shows the values inside it in the player list.
  • An IntValue holds a whole number. Here it holds the player's cash.

More detail

  • ServerScriptService is in the Explorer list. Scripts in it run on the server, where players cannot change them.
  • The script opens in a new tab. Click inside the code, press Ctrl+A and then Ctrl+V to replace everything.
  • Go back to your world by clicking the tab with the name of your place.
  • The player list is in the top right corner of the game. Press F5 to start and Shift+F5 to stop.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

3
Step 3 / 9

Build the dropper

  1. Add a Part into the Tycoon folder. Set Size to 4, 1, 4, turn on Anchored and name it Dropper.
  2. Lift it about 10 studs above the floor with the Move tool (Ctrl+2).
  3. Add a Script to Dropper and paste this code.
  4. Press Play. A yellow cube falls every 2 seconds.
Dropper > Script
local Debris = game:GetService("Debris")
local dropper = script.Parent

while true do
	task.wait(2)

	local cube = Instance.new("Part")
	cube.Name = "Cube"
	cube.Size = Vector3.new(1.5, 1.5, 1.5)
	cube.Color = Color3.fromRGB(255, 200, 60)
	cube.Position = dropper.Position - Vector3.new(0, 2, 0)
	cube.Parent = workspace

	Debris:AddItem(cube, 20)
end

What each part does

  • Instance.new creates a new part from code.
  • Position places the cube 2 studs below the dropper.
  • Debris removes each cube after 20 seconds, so old cubes never pile up.

More detail

  • To put the part into the folder, drag its name in Explorer onto the name Tycoon.
  • With the Move tool, drag the green arrow upward. The Position field in Properties shows the height as the middle number.
  • The cube appears 2 studs below the dropper and then falls. If the dropper is too low, the cubes pile up under it.
  • The first cube comes 2 seconds after the game starts.
Common mistake. No cubes appear: check that the script is inside Dropper and that Dropper is Anchored.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

4
Step 4 / 9

Add the conveyor

  1. Add a Part, set Size to 6, 1, 30, turn on Anchored and name it Conveyor.
  2. Place it on the floor so that one end is right under the dropper.
  3. Add a Script to Conveyor and paste this code.
  4. Press Play. The cubes land on the conveyor and slide along it.
Conveyor > Script
local conveyor = script.Parent

conveyor.AssemblyLinearVelocity = conveyor.CFrame.LookVector * 8

What each part does

  • AssemblyLinearVelocity tells Roblox how fast things on top of the part should move.
  • LookVector is the direction the front of the part faces. The number 8 is the speed in studs per second.

More detail

  • Every part has a front. The conveyor pushes cubes toward its front.
  • The long side of the conveyor, the 30 studs, must point away from the dropper, toward the place where the collector will stand.
  • The conveyor itself does not move. Only the things on top of it slide.
  • If cubes fall off the side, make the conveyor wider or move the dropper to the middle of it.
Common mistake. The cubes slide the wrong way: turn the conveyor 180 degrees with the Rotate tool (Ctrl+4).
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

5
Step 5 / 9

Collect the cubes

  1. Add a Part at the far end of the conveyor. Set Size to 6, 4, 1, turn on Anchored, make it green and name it Collector.
  2. Stand it upright like a wall, so the cubes run into it.
  3. Add a Script to Collector and paste this code.
  4. Press Play. Every cube that reaches the collector adds 5 to Cash.
Collector > Script
local Players = game:GetService("Players")
local collector = script.Parent

collector.Touched:Connect(function(hit)
	if hit.Name ~= "Cube" then return end
	hit:Destroy()

	for _, player in ipairs(Players:GetPlayers()) do
		local stats = player:FindFirstChild("leaderstats")
		if stats then
			stats.Cash.Value += 5
		end
	end
end)

What each part does

  • The script ignores everything that is not named Cube. Your feet do not count.
  • Destroy removes the cube from the game.
  • The loop gives 5 cash to every player in the server. A tycoon with one owner per plot is an advanced lesson.

More detail

  • Size 6, 4, 1 already stands upright: 6 wide, 4 high and 1 thick. Put it across the end of the conveyor like a gate that is closed.
  • Its bottom edge should touch the conveyor, so no cube can slip under it.
  • To make it green, click the Color field in Properties.
  • To test: press F5 and watch the player list. Cash goes up by 5 each time a cube reaches the wall.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

6
Step 6 / 9

Prepare the second dropper

  1. Select Dropper and press Ctrl+D. Name the copy Dropper2 and move it next to the first one, still above the conveyor.
  2. Drag Dropper2 from Workspace into ServerStorage.
  3. It disappears from the world. Objects in ServerStorage wait there until a script moves them back.

More detail

  • The copy sits exactly on top of the original. Drag it sideways with the Move tool so you can see both.
  • Rename the copy with F2. The name must be Dropper2, with a capital D and no space.
  • ServerStorage is in the Explorer list. Drag the name Dropper2 onto it.
  • The script inside the copy came along with it. You do not need to add it again.
Tip. Scripts inside ServerStorage do not run. That is why the second dropper stays quiet until someone buys it.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

7
Step 7 / 9

Add a buy button

  1. Add a Part on the floor near the conveyor. Set Size to 4, 1, 4, turn on Anchored, make it bright blue and name it BuyDropper.
  2. Add a Script to BuyDropper and paste this code.
  3. To label the button, hover over BuyDropper, click + and add a BillboardGui. Set its Size to {0, 200}, {0, 50} and its StudsOffset to 0, 3, 0.
  4. Add a TextLabel into the BillboardGui. Set its Size to {1, 0}, {1, 0}, turn on TextScaled and type this text: Second dropper - 50
BuyDropper > Script
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local button = script.Parent
local PRICE = 50
local bought = false

button.Touched:Connect(function(hit)
	if bought then return end

	local player = Players:GetPlayerFromCharacter(hit.Parent)
	local stats = player and player:FindFirstChild("leaderstats")
	if not stats or stats.Cash.Value < PRICE then return end

	bought = true
	stats.Cash.Value -= PRICE
	ServerStorage.Dropper2.Parent = workspace
	button:Destroy()
end)

What each part does

  • PRICE is the cost. Change the number to make the button cheaper or more expensive.
  • The script checks that a real player touched the button and that the player has enough cash.
  • Moving Dropper2 into workspace switches it on. Its script starts running right away.

More detail

  • Players buy by walking onto the button, so put it on the floor where it is easy to reach.
  • For Size and StudsOffset, click the field in Properties, type the numbers exactly as shown, with the brackets and commas, and press Enter.
  • Text is a property of the TextLabel. Click the Text field, type the words and press Enter.
  • The label floats above the button. If you cannot see it, raise the middle number of StudsOffset.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

8
Step 8 / 9

Test the whole loop

  1. Press F5. Watch the cubes fall, ride the conveyor and turn into cash.
  2. Wait until you have 50 cash, then step on the blue button.
  3. The second dropper appears, the button disappears and your cash grows twice as fast.
  4. Press Shift+F5 to stop. If something fails, open the Output window from the Window menu and read the red text.

More detail

  • It takes 10 cubes, so at least 20 seconds, to reach 50 cash.
  • After you buy, Cash drops by 50. That is correct. You paid for the dropper.
  • The button is destroyed after the purchase, so it cannot be bought twice.
  • If the second dropper appears in the wrong place, stop the game, drag Dropper2 from ServerStorage back into Workspace, move it, and drag it into ServerStorage again.
Common mistake. Cash never changes: the falling parts must be named Cube, exactly as in the dropper script.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

9
Step 9 / 9

Publish it

  1. Choose File → Publish to Roblox. Give the game a name and a short description.
  2. On the Creator Hub website open your game and fill in the Maturity questionnaire.
  3. Set the game to Public and send the link to a friend.

More detail

  • The first time you publish, Studio asks for a name and a description. Click Create.
  • Creator Hub is the website create.roblox.com. Sign in with the same account and click your game in the list.
  • Roblox may ask for more before a game can be public, for example an age check on the account. The page tells you what is missing.
  • If you are under 18, do this step together with a parent.
Tip. Progress is not saved yet. When a player leaves, the cash is gone. Saving data is an advanced lesson.
This step does not work for me

Check these three things first

  • The name of every part and script is exactly as in the guide, with the same capital letters.
  • The script sits inside the right object. Look at the label above the code box.
  • Open the Output window from the Window menu. Red text shows the script and the line with the problem.

Still stuck? Write to us →

Now change it yourself

  • Make each cube worth 10 cash instead of 5.
  • Add a third dropper that costs 200 cash.
  • Make the second dropper faster than the first one. Which number do you change?