๐Ÿญ My First Roblox Studio Game ยท Episode 2 of 6 ยท See All Episodes
๐Ÿญ Episode 2 ยท Lua Scripting ยท Cash System

Money Factory!
Tycoon Game

Build a Roblox Tycoon with a dropper that earns cash, a collector, buy pads to unlock upgrades and a GUI that shows your money then watch the coins roll in!

๐Ÿ‘ถ Ages 7+ โฑ๏ธ ~1.5 Hours ๐ŸŸฆ Roblox Studio โœ“ Free
โญ
0 XP
Level 1
๐Ÿ”ฅ0
Your Progress0 / 10 steps
1
๐Ÿ—บ๏ธ
Set Up Your Tycoon Plot
Create the base map and player area
Active
๐ŸŽฏ
Goal for this step

Create a flat plot of land where the factory will be built.

๐Ÿ‘จโ€๐Ÿ‘ง
Parent note: Open Roblox Studio with a Baseplate template. This episode uses some Lua scripting we'll explain every line as we go. Take it slow!

Build the plot

  • 1Open Roblox Studio โ†’ Baseplate template.
  • 2Add a large Part, size 60, 1, 60, position 0, 0, 0. BrickColor: Medium stone grey. This is the factory floor.
  • 3Add 4 wall parts around the edge (size 60, 8, 1 for front/back, 1, 8, 60 for sides). BrickColor: Dark grey. Position them so they form a box around the floor.
  • 4Add a SpawnLocation (Model tab โ†’ Spawn) inside the box. This is where the player starts.
  • 5Select all the parts you just made, right-click in Explorer โ†’ Group (Ctrl+G). Rename the group Plot.
๐Ÿง 
Knowledge Check
+15 XP
What does grouping parts with Ctrl+G do in Roblox Studio?
ADeletes the parts
BCombines them into a single Model or Group
CChanges their color
2
โฌ‡๏ธ
Build the Dropper
A machine that spawns falling bricks that earn cash
Locked
๐ŸŽฏ
Goal for this step

Create a dropper โ€” a box that spits out a new part every 2 seconds that falls down.

Make the dropper box

  • 1Add a Part, size 4, 4, 4. Place it near one corner of your plot, raised up at Y=8. BrickColor: Bright blue. Name it Dropper.
  • 2Set Anchored to true so it doesn't fall.
  • 3Right-click Dropper in Explorer โ†’ Insert Object โ†’ Script. Paste this:
Script (inside Dropper)
local dropper = script.Parent while true do task.wait(2) local brick = Instance.new("Part") brick.Size = Vector3.new(2, 2, 2) brick.BrickColor = BrickColor.new("Bright yellow") brick.Position = dropper.Position - Vector3.new(0, 3, 0) brick.Parent = workspace brick.Name = "DropBrick" game.Debris:AddItem(brick, 10) -- auto-delete after 10 seconds end
๐Ÿ“–
Every 2 seconds a yellow brick spawns below the dropper and falls. The Debris:AddItem cleans them up automatically so your game doesn't fill up with bricks!
  • 4Press Play to test you should see yellow bricks falling from the box every 2 seconds.
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks to complete the dropper script:
local brick = Instance.new("") brick.Size = Vector3.new(, 2, 2) brick.Parent =
๐Ÿ’ก Hint: Look at the full script above โ€” the answers are all there!
โœ๏ธFill in the Blanks+15 XP

The dropper uses a true do loop to keep spawning bricks every seconds. The :AddItem function automatically deletes each brick after 10 seconds.

โšกTrue or False?+15 XP
The dropper part must have Anchored set to true so it doesn't fall.
Each spawned brick stays in the game forever.
Instance.new("Part") creates a brand new part in Lua.
๐Ÿง 
Knowledge Check
+15 XP
What does game.Debris:AddItem(brick, 10) do?
AMakes the brick bigger after 10 seconds
BAutomatically deletes the brick after 10 seconds
CMoves the brick 10 studs
3
๐Ÿ“ฅ
Add the Collector
A platform that collects bricks and converts them to cash
Locked
๐ŸŽฏ
Goal for this step

Add a collector below the dropper. When a brick lands on it, it vanishes and you earn $10.

Add cash to the player

  • 1In the Explorer, find ServerScriptService. Right-click it โ†’ Insert Object โ†’ Script. Name it SetupCash. Paste:
Script in ServerScriptService
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Value = 0 cash.Parent = leaderstats end)
๐Ÿ“–
The leaderstats folder is special โ€” Roblox automatically shows its contents as a leaderboard in the top-right corner of the game!

Build the collector

  • 2Add a Part directly below the Dropper, at the floor level. Size: 6, 1, 6. BrickColor: Bright green. Name it Collector. Set Anchored = true.
  • 3Right-click Collector โ†’ Insert Object โ†’ Script. Paste:
Script (inside Collector)
local collector = script.Parent collector.Touched:Connect(function(hit) if hit.Name == "DropBrick" then hit:Destroy() local players = game.Players:GetPlayers() if #players > 0 then local cash = players[1].leaderstats.Cash cash.Value = cash.Value + 10 end end end)
  • 4Press Play and wait a few seconds. Look at the top right of the screen you should see Cash: 10, 20, 30... going up!
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks for the collector script:
if hit.Name == "" then hit:() cash.Value = cash.Value +
๐Ÿ’ก Hint: Look at the collector script above โ€” what name do the bricks have? What function removes them?
๐Ÿง 
Knowledge Check
+15 XP
Why is the folder named 'leaderstats' special in Roblox?
AIt makes the game run faster
BRoblox automatically shows its contents as a leaderboard
CIt's required for scripts to work
4
๐Ÿ›’
Add a Buy Pad
A button players walk onto to spend cash and unlock new things
Locked
๐ŸŽฏ
Goal for this step

Create a buy pad walk onto it with enough cash and something unlocks!

Build the buy pad

  • 1Add a Part, size 6, 0.5, 6. BrickColor: Bright red. Material: Neon. Name it BuyPad. Anchored = true. Place it somewhere in your plot.
  • 2Add a second flat part above it as a sign (size 6, 3, 0.2) this will show the price. Name it PriceSign.
  • 3Right-click BuyPad โ†’ Insert Object โ†’ Script. Paste:
Script (inside BuyPad)
local pad = script.Parent local price = 50 local bought = false pad.Touched:Connect(function(hit) if bought then return end local player = game.Players:GetPlayerFromCharacter(hit.Parent) if not player then return end local cash = player.leaderstats.Cash if cash.Value >= price then cash.Value = cash.Value - price bought = true pad.BrickColor = BrickColor.new("Bright green") print("Purchased! Something unlocks here...") end end)
๐Ÿ“–
Change price = 50 to any amount. When you walk on it with enough cash, the pad turns green. Later you can make it spawn a new dropper or upgrade!
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks for the buy pad script:
local player = game.Players:(hit.Parent) if cash.Value >= then bought =
๐Ÿ’ก Hint: How do you get a Player from a character model? What variable holds the cost?
๐Ÿ”ขOrder the Steps+15 XP

Click each step in the correct order to build a working buy pad:

Add a Script inside the BuyPad that checks cash on Touched
Add a Part and name it BuyPad
Press Play and walk onto the pad to test it
Set Anchored to true and choose a BrickColor
๐Ÿง 
Knowledge Check
+15 XP
What does 'return' do inside the BuyPad's Touched function?
ARestarts the whole script
BExits the function early so nothing else runs
CPrints a message
5
โฌ†๏ธ
Unlock a Second Dropper
Make the buy pad spawn a faster dropper when purchased
Locked
๐ŸŽฏ
Goal for this step

When the buy pad is purchased, a second dropper appears that drops bricks faster!

Update the buy pad script

  • 1Add a second Part (size 4, 4, 4, BrickColor Bright red) somewhere in your plot. Anchor it. Name it Dropper2. In Properties, set Transparency to 1 so it's invisible at the start.
  • 2Add a Script inside Dropper2 โ€” same dropper script from Step 2, but change task.wait(2) to task.wait(1) for double speed. Also start the script with:
Top of Dropper2 Script
local dropper = script.Parent dropper.Transparency = 1 dropper.CanCollide = false -- Wait for an event to unlock script.Parent:WaitForChild("UnlockEvent").Event:Wait() dropper.Transparency = 0 dropper.CanCollide = true while true do task.wait(1) local brick = Instance.new("Part") brick.Size = Vector3.new(2,2,2) brick.BrickColor = BrickColor.new("Bright red") brick.Position = dropper.Position - Vector3.new(0,3,0) brick.Parent = workspace brick.Name = "DropBrick" game.Debris:AddItem(brick,10) end
  • 3Add a BindableEvent inside Dropper2: right-click Dropper2 โ†’ Insert Object โ†’ BindableEvent. Name it UnlockEvent.
  • 4In your BuyPad script, after print("Purchased!") add: workspace.Dropper2.UnlockEvent:Fire().
๐Ÿ’ก
Now when you buy the pad, Dropper2 appears and starts working twice as fast โ€” earning you $20 every 2 seconds instead of $10!
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks for the Dropper2 script:
dropper.Transparency = dropper.CanCollide = task.wait()
๐Ÿ’ก Hint: Transparency 1 = invisible. CanCollide false = things pass through it. The wait time is 1 second for double speed.
๐Ÿ”ฎPredict What Happens+15 XP
Scenario: You set Dropper2's Transparency to 1 and CanCollide to false, but you forget to add the UnlockEvent BindableEvent inside it. What happens when the game runs?
ADropper2 appears immediately and works normally
BThe game crashes with an error
CDropper2's script waits forever at WaitForChild and never activates
๐Ÿง 
Knowledge Check
+15 XP
Why does Dropper2 start with Transparency = 1?
ASo it's invisible until the player buys the upgrade
BSo it falls through the floor
CTo make it glow
6
๐Ÿ’ฐ
Cash Display GUI
Show the player's cash in big letters on screen
Locked
๐ŸŽฏ
Goal for this step

Add a big on-screen cash counter so players always know how rich they are.

Create the GUI

  • 1In Explorer, find StarterGui. Right-click โ†’ Insert Object โ†’ ScreenGui. Name it CashGui.
  • 2Right-click CashGui โ†’ Insert Object โ†’ TextLabel. Name it CashLabel.
  • 3Select CashLabel. In Properties: set Text to ๐Ÿ’ฐ $0, TextSize to 28, TextColor3 to yellow, Font to GothamBold.
  • 4Set Position to {0.02, 0}, {0.05, 0} (top-left corner) and Size to {0.2, 0}, {0.06, 0}.
  • 5Set BackgroundTransparency to 1 so there's no background box.
  • 6Right-click CashGui โ†’ Insert Object โ†’ LocalScript. Paste:
LocalScript (inside CashGui)
local player = game.Players.LocalPlayer local label = script.Parent.CashLabel player:WaitForChild("leaderstats").Cash.Changed:Connect(function(val) label.Text = "๐Ÿ’ฐ $" .. val end)
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks for the GUI script:
local player = game.Players. label.Text = "๐Ÿ’ฐ $" ..
๐Ÿ’ก Hint: In a LocalScript, the current player is accessed with game.Players.??? โ€” and the Changed function passes the new value as a parameter.
โœ๏ธFill in the Blanks+15 XP

To show text on screen, we add a inside StarterGui. The cash label uses a to update itself, because GUI code runs on the side.

๐Ÿง 
Knowledge Check
+15 XP
What is the difference between a Script and a LocalScript?
AScripts are newer than LocalScripts
BScripts run on the server, LocalScripts run on the player's computer
CThere is no difference
7
๐Ÿท๏ธ
Price Signs
Add floating text above the buy pads showing their price
Locked
๐ŸŽฏ
Goal for this step

Add a floating BillboardGui label above each buy pad so players know the cost.

Add a BillboardGui

  • 1Select your BuyPad in Explorer. Right-click โ†’ Insert Object โ†’ BillboardGui.
  • 2Set its Size to {0, 200}, {0, 50} and StudsOffset to 0, 4, 0 (floats 4 studs above the pad).
  • 3Right-click BillboardGui โ†’ Insert Object โ†’ TextLabel. Set Text to ๐Ÿ›’ $50. Set TextScaled to true. Set BackgroundTransparency to 1. Set TextColor3 to white. Set Font to GothamBold.
  • 4Also set Size on the TextLabel to {1,0},{1,0} (fill the whole BillboardGui).
  • 5Press Play โ€” you should see the price floating above the pad!
๐Ÿ’ก
In your BuyPad script, when it's purchased you can change the TextLabel text to "โœ… Bought!" so players know they've already bought it.
๐Ÿง 
Knowledge Check
+15 XP
What does StudsOffset on a BillboardGui do?
AChanges the text size
BMoves the GUI up/down/sideways relative to the parent part
CMakes the GUI spin
8
๐ŸŽจ
Decorate Your Factory
Make it look like a real money-making machine!
Locked
๐ŸŽฏ
Goal for this step

Add decorative parts to make your tycoon look amazing conveyor belts, pipes, lights!

๐Ÿ‘จโ€๐Ÿ‘ง
Parent note: This is the creative free-build step โ€” let your child go wild decorating. There's no scripting, just placing and sizing parts!

Decoration ideas

  • 1Add tall thin cylinder parts as chimney stacks. Set Material to Metal.
  • 2Add Neon coloured flat parts as glowing floor strips or warning lights.
  • 3Use SpecialMesh (right-click a part โ†’ Insert Object โ†’ SpecialMesh, set MeshType to Cylinder or Sphere) to make pipes or tanks.
  • 4Add PointLight objects inside Neon parts (Insert Object โ†’ PointLight) to cast coloured light.
  • 5Group all your decorations into a folder called Decorations to keep Explorer tidy.
๐ŸŽจ
Think about what kind of factory this is โ€” a cookie factory? A robot factory? A diamond mine? Decorate it to match!
โšกTrue or False?+15 XP
A PointLight inside a Neon part will cast coloured light on nearby objects.
You need a script to change a part's Material property โ€” it can't be done in Properties.
Grouping decorations into a folder keeps the Explorer panel tidy.
๐Ÿง 
Knowledge Check
+15 XP
Which material makes parts glow in Roblox Studio?
APlastic
BMetal
CNeon
9
๐Ÿ’พ
Save Player Data
Use DataStore so cash saves when players leave and come back
Locked
๐ŸŽฏ
Goal for this step

Make the player's cash save permanently so they keep their money next time they play!

โš ๏ธ
DataStores only work in published games. They won't save during Play testing in Studio that's normal!

Enable API access

  • 1Go to Home โ†’ Game Settings โ†’ Security. Turn on Enable Studio Access to API Services. Click Save.

Update the SetupCash script

  • 2Open the SetupCash script in ServerScriptService. Replace it with this full version:
SetupCash Script (full version with saving)
local DataStoreService = game:GetService("DataStoreService") local cashStore = DataStoreService:GetDataStore("CashStore") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Parent = leaderstats local saved = cashStore:GetAsync(player.UserId) cash.Value = saved or 0 end) game.Players.PlayerRemoving:Connect(function(player) cashStore:SetAsync(player.UserId, player.leaderstats.Cash.Value) end)
๐Ÿ’ป
Code Challenge
+20 XP
Fill in the blanks for the DataStore script:
local cashStore = DataStoreService:("CashStore") cash.Value = saved or cashStore:(player.UserId, player.leaderstats.Cash.Value)
๐Ÿ’ก Hint: You GET a DataStore, default to 0 if nothing saved, and SET data when the player leaves.
โœ๏ธFill in the Blanks+15 XP

Data is loaded when the player joins using and saved when the player leaves using . Each player is identified by their unique .

๐Ÿ”ฎPredict What Happens+15 XP
Scenario: A player earns $500 in your tycoon but you haven't published the game yet โ€” it's only in Studio. They leave and rejoin. What happens to their cash?
ATheir cash is saved and restored to $500
BTheir cash resets to $0 because DataStores only work in published games
CThe game shows an error and won't load
๐Ÿง 
Knowledge Check
+15 XP
Why do DataStores only work in published games?
ABecause Studio doesn't have internet access to Roblox's cloud storage
BBecause DataStores cost Robux
CBecause scripts don't run in Studio
10
๐ŸŒ
Test & Publish!
Play your tycoon, check everything works and share it with friends
Locked
๐ŸŽฏ
Goal for this step

Final test, save and publish your tycoon to Roblox!

  • 1Press Play. Wait for cash to build up from the dropper.
  • 2Walk onto the BuyPad when you have $50. Confirm Dropper2 appears and the pad turns green.
  • 3Check the Cash GUI updates correctly.
  • 4Press Stop.
  • 5Go to File โ†’ Publish to Roblox. Set a fun name like "My Money Factory Tycoon!" and set Privacy to Public.
  • 6Share the game link with friends and family!
๐ŸŽ‰
Want to add more? Try adding a 3rd dropper with a higher price, or change the $10 per brick to $25 for the upgraded dropper!
๐Ÿ”ขOrder the Steps+15 XP

Put the final testing and publishing steps in the right order:

Go to File โ†’ Publish to Roblox and set Privacy to Public
Press Play and test that droppers, collectors and buy pads all work
Share the game link with friends and family
Press Stop and check the Explorer is tidy
๐Ÿง 
Final Knowledge Check
+15 XP
Which of these did you NOT build in this workshop?
AA dropper that spawns bricks
BA racing system with checkpoints
CA buy pad that unlocks upgrades
DA cash GUI display
๐ŸŽ‰๐Ÿญ๐Ÿ’ฐ๐ŸŽŠ๐Ÿ’ต
You Built a Tycoon!

Incredible! You made a working Roblox Tycoon with droppers, collectors, buy pads, a GUI and saved data. Ready for Episode 3?

0
Total XP
1
Level
0
Best Streak
0%
Accuracy
๐Ÿพ Episode 3: Pet Simulator โ†’ โญ View My Progress & Certificates

This workshop was free and took many hours to build. If it helped you learn something new, consider supporting the project.

☕ Support on Ko-fi