Stage 7: Rolling Rocks + collector upgrade
Finish Stage 6. Your coin machine has a DropperUpgrade pad that makes future dropped coins worth more.
a rolling-rocks ramp, the Stage 8 checkpoint, and a CollectorUpgrade pad that improves the coin payout
how to keep all coin payouts flowing through one helper function, then tune the collector bonus in one place
a tycoon where the player upgrades both ends of the machine: the Dropper creates better coins and the Collector pays a bonus
60-second demo:
- Watch a dropped coin reach the Collector before buying. It pays its normal
CoinValue. - Buy
CollectorUpgradefor 60 coins. - Watch another coin arrive. The collector adds a bonus to the payout.
- Explain: "The Dropper controls what gets produced. The Collector controls what gets paid."
The big idea
Stage 6 improved the start of the machine: the Dropper creates better coins. Stage 7 improves the end of the machine: the Collector pays a bonus when coins arrive.
To keep the code simple, every coin payout should go through one helper: awardCoins(player, amount). Checkpoints, pickups, and the Collector can all call the same helper. That keeps the course focused on the coin machine.
- helper function
- a small named function that wraps repeated logic so the rest of the script can call it
- collector bonus
- extra coins added when the Collector pays a dropped coin
- single source of truth
- one function owns a behavior so you do not rewrite the same logic in many places
Build it
Step 1 — Build the rolling rocks ramp
A ramp going up from Stage 7's orange pad, with one cover block and one boulder spawner at the top. Same as base obby Stage 7.

Build this partRockRamp
WedgeOpen recipe
RockRamp
Wedge- Size
- 6 × 8 × 30
- Color
- Dark stone grey
- Material
- Slate
- Anchored
- ✓ Yes
- Place
- In front of the Stage 7 orange pad, sloping up
Build this partCoverBlock
BlockOpen recipe
CoverBlock
Block- Size
- 3 × 4 × 1
- Color
- Reddish brown
- Material
- Wood
- Anchored
- ✓ Yes
- Place
- Standing on RockRamp, about halfway up, off to one side
Build this partBoulderSpawner
BlockOpen recipe
BoulderSpawner
Block- Size
- 2 × 2 × 2
- Color
- Bright red
- Material
- Neon
- Anchored
- ✓ Yes
- Place
- At the very top of RockRamp
Right-click BoulderSpawner -> Insert Object -> Script. Open the editor, delete the placeholder line, and type:
local spawner = script.Parent
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
while true do
local boulder = Instance.new("Part")
boulder.Shape = Enum.PartType.Ball
boulder.Size = Vector3.new(3, 3, 3)
boulder.Color = Color3.fromRGB(80, 60, 50)
boulder.Material = Enum.Material.Slate
boulder.Position = spawner.Position
boulder.Anchored = true
boulder.Touched:Connect(function(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then humanoid.Health = 0 end
end)
boulder.Parent = workspace
local destination = spawner.Position + Vector3.new(0, -8, -30)
local info = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
TweenService:Create(boulder, info, { Position = destination }):Play()
Debris:AddItem(boulder, 4)
task.wait(2)
end
Step 2 — Wire the Stage 8 checkpoint
Build this partSpawnLocation (Stage 8 — top of rocky ramp)
BlockOpen recipe
SpawnLocation (Stage 8 — top of rocky ramp)
Block- Size
- 6 × 1 × 6
- Color
- Lime green
- Material
- Plastic
- Anchored
- ✓ Yes
- Place
- At the top of RockRamp
Also: check AllowTeamChangeOnTouch. Uncheck Neutral. Set TeamColor to Lime green.
Tag this SpawnLocation with StageNumber = 8.
In Teams, insert a new Team named Stage 8. Set its TeamColor to Lime green. Uncheck AutoAssignable.
Step 3 — Build the CollectorUpgrade pad
Build this partCollectorUpgrade
BlockOpen recipe
CollectorUpgrade
Block- Size
- 4 × 0.5 × 4
- Color
- Gold
- Material
- Neon
- Anchored
- ✓ Yes
- Place
- On the Start Platform (`Lobby` part), near the Collector
Place this near the Collector so students connect the purchase to the payout destination.
Add a ProximityPrompt to CollectorUpgrade:
- ActionText ->
Upgrade Collector (60 coins) - HoldDuration ->
0.5 - MaxActivationDistance ->
6
Step 4 — Create one awardCoins helper
Open TycoonEconomy. Add this helper near the top of the script, below machineUpgrades:
This stage cleans up old payout lines before adding the collector bonus. awardCoins becomes the one doorway for giving coins. After each replacement below, the old direct Coins.Value = Coins.Value + ... line should be gone.
local function awardCoins(player, amount)
if not player or not player:FindFirstChild("leaderstats") then return end
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + amount
end
Now replace the three direct coin-award lines from earlier stages:
Checkpoint rewards from Stage 2
Find the checkpoint reward line from Stage 2. Replace only this line:
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + stageNumber
with:
awardCoins(player, stageNumber)
Pickup rewards from Stage 3
Find the pickup reward line inside wirePickup. Replace only this line:
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + value
with:
awardCoins(player, value)
Collector payout from Stage 5
Find the collector payout line inside the Collector Touched handler. Replace only this line:
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + value
with:
awardCoins(player, value)
Press Play after each replacement. The game should behave the same. That is the point: the code is cleaner before the behavior changes.
Step 5 — Add the collector bonus
Add a collector level to the player upgrade data. Find the Stage 6 PlayerAdded line:
machineUpgrades[player] = { dropperLevel = 0 }
Change it to:
machineUpgrades[player] = { dropperLevel = 0, collectorLevel = 0 }
Add this helper below awardCoins:
local function getCollectorBonus()
local bestLevel = 0
for _, data in pairs(machineUpgrades) do
bestLevel = math.max(bestLevel, data.collectorLevel or 0)
end
return bestLevel * 2
end
In the Collector Touched handler, change the payout call to include the bonus:
awardCoins(player, value + getCollectorBonus())
That means the Collector payout has two edits this stage: first it changed from direct math to awardCoins(player, value), then it changes to awardCoins(player, value + getCollectorBonus()). Keep only the final version.
Before the upgrade, collectorLevel is 0, so the bonus is 0. Behavior still matches Stage 5.
Step 6 — Wire the CollectorUpgrade purchase
Add this near the DropperUpgrade purchase code:
local COLLECTOR_UPGRADE_COST = 60
local collectorUpgradePad = workspace:WaitForChild("CollectorUpgrade")
local collectorUpgradePrompt = collectorUpgradePad:FindFirstChildWhichIsA("ProximityPrompt")
collectorUpgradePrompt.Triggered:Connect(function(player)
if not player or not player:FindFirstChild("leaderstats") then return end
local data = machineUpgrades[player]
if not data then return end
if data.collectorLevel >= 1 then return end
if player.leaderstats.Coins.Value < COLLECTOR_UPGRADE_COST then return end
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - COLLECTOR_UPGRADE_COST
data.collectorLevel = 1
collectorUpgradePrompt.ActionText = "Collector Lv 2"
end)
Press Play. Earn 60+ coins, buy the CollectorUpgrade, then let a dropped coin reach the Collector. If a coin's value is 4 and the collector bonus is 2, the payout is 6.
Understand it
The Collector upgrade is still coin-only, but it teaches a stronger programming idea than a basic purchase: centralized payout logic. Checkpoints, pickups, and the Collector all use awardCoins. The Collector can add a bonus before calling the helper, and the rest of the script stays readable.
The split is clean:
DroppedCoin.CoinValueanswers: "What did the Dropper produce?"getCollectorBonus()answers: "How much extra does the Collector add?"awardCoins(player, amount)answers: "How do coins get credited to the player?"
How the Collector upgrade adds a bonus
The Collector reads the dropped coin value, adds the collector bonus, then sends the final amount through awardCoins.
local function awardCoins(player, amount)
if not player or not player:FindFirstChild("leaderstats") then return end
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + amount
end
local function getCollectorBonus()
local bestLevel = 0
for _, data in pairs(machineUpgrades) do
bestLevel = math.max(bestLevel, data.collectorLevel or 0)
end
return bestLevel * 2
end
-- inside Collector.Touched
local value = otherPart:GetAttribute("CoinValue") or 0
awardCoins(player, value + getCollectorBonus())
Lines 1–4One payout function.
Every coin source can use this same helper. No multipliers, no player powers, just one safe way to credit coins.
Lines 6–12Collector bonus stays separate.
The bonus belongs to the Collector, so compute it before the payout helper is called.
Try this
Try this
Three short experiments. Predict before you run, then test your guess.
If the Dropper makes 4-value coins and the Collector adds +2, what should one collected coin pay? Predict, then test it.
Temporarily remove the collector bonus from the payout call. What still works? What part of the tycoon loop feels less rewarding?
If you wanted a Level 3 Collector, would you change the Collector script, the helper, or just the upgrade purchase rules?
Test your stage
- Press Play. The rolling rocks ramp works and the lime Stage 8 checkpoint pays.
- Before buying, dropped coins pay their current
CoinValue. - Earn 60+ coins and buy
CollectorUpgrade. - Dropped coins now pay
CoinValue + 2. - Pickups and checkpoints still pay correctly through
awardCoins. - Design check.
DropperUpgradeis near the Dropper andCollectorUpgradeis near the Collector, so the machine reads clearly.
If it breaks
- Only collector coins work; checkpoints broke. The
awardCoinshelper may be below the checkpoint code. Move it near the top before it is called. - Collector bonus never applies. Confirm PlayerAdded initializes
collectorLevel = 0, and the purchase sets it to 1. - Collector coins pay twice. Make sure the old direct
Coins.Valueline was replaced, not left next toawardCoins. - Boulders roll the wrong way. Flip the destination vector direction or rotate the ramp.
Keep the language grounded: the player is upgrading the Collector so the coin machine pays better.
- 45 minutes. Rolling rocks ramp 15. Stage 8 checkpoint 5. Helper refactor 10. CollectorUpgrade 15.
- If the helper refactor causes confusion, slow down and test one coin source at a time.