← All guides
Guide 3

Build your first simulator

Click a crystal to gain power, sell the power for coins and buy upgrades that make every click stronger.

Free50 minutes · Beginner · Roblox Studio
1
Step 1 / 8

Set up the place

  1. Open Roblox Studio, click New Experience and choose the Baseplate template.
  2. You will build three things on the floor: a crystal to click, a pad to sell on and a pad to buy upgrades.
  3. Leave about 20 studs between them, so players have to walk.

More detail

  • The Baseplate template is in the list of templates on the start screen.
  • The Position field in Properties shows where a part is. Two parts whose first numbers are 20 apart stand 20 studs from each other.
  • Keep the three things close to the SpawnLocation, the platform where players appear.
  • On a Mac, use the Cmd key every time this guide says Ctrl.
Tip. Draw the layout on paper first. A simulator feels good when the walk between click, sell and upgrade is short.
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 / 8

Create the player stats

  1. Hover over ServerScriptService, click + and add a Script. Name it Stats.
  2. Delete the line that is already there and paste this code.
  3. Press Play. The player list shows Power 0 and Coins 0.
ServerScriptService > Stats
local Players = game:GetService("Players")

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

	for _, name in ipairs({"Power", "Coins"}) do
		local value = Instance.new("IntValue")
		value.Name = name
		value.Parent = stats
	end

	local multiplier = Instance.new("IntValue")
	multiplier.Name = "Multiplier"
	multiplier.Value = 1
	multiplier.Parent = player
end)

What each part does

  • The loop creates two values with one piece of code: Power and Coins.
  • Multiplier is how much power one click gives. It starts at 1.
  • Multiplier sits on the player and not in leaderstats, so it stays hidden from the player list.

More detail

  • When you click +, type the word Script to find it quickly.
  • The script opens in a new tab. Click inside the code, press Ctrl+A and then Ctrl+V to replace everything.
  • Rename the script in Explorer with F2. The name is only for you. It helps you find the script later.
  • The player list is in the top right corner of the game.
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 / 8

Build the crystal

  1. Add a Part. Set Size to 6, 8, 6, turn on Anchored and name it Crystal. Pick a bright color and set Material to Neon.
  2. Hover over Crystal, click + and add a ClickDetector.
  3. Add a Script to Crystal and paste this code.
  4. Press Play and click the crystal. Power goes up by 1 on every click.
Crystal > Script
local crystal = script.Parent
local clickDetector = crystal.ClickDetector

clickDetector.MouseClick:Connect(function(player)
	local power = player.leaderstats.Power
	power.Value += player.Multiplier.Value
end)

What each part does

  • A ClickDetector makes a part clickable. It also works with taps on phones.
  • MouseClick tells the script which player clicked.
  • The script adds the player's Multiplier to Power, so upgrades make every click stronger.

More detail

  • Type the size into the Size field in Properties and press Enter. Then lift the crystal with the Move tool until it stands on the floor.
  • When you click +, type ClickDetector to find it. In Explorer it must sit one step to the right, under Crystal.
  • In the game, the mouse pointer changes to a hand when it is over the crystal.
  • You must stand close enough. A ClickDetector works from 32 studs away or less.
Common mistake. Nothing happens on click: the ClickDetector must sit directly inside Crystal, next to the 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 →

4
Step 4 / 8

Add the sell pad

  1. Add a Part on the floor. Set Size to 8, 1, 8, turn on Anchored, make it yellow and name it Sell.
  2. Add a Script to Sell and paste this code.
  3. Press Play, click the crystal a few times and walk onto the pad. Power turns into Coins.
Sell > Script
local Players = game:GetService("Players")
local pad = script.Parent

pad.Touched:Connect(function(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if not player then return end

	local stats = player.leaderstats
	if stats.Power.Value > 0 then
		stats.Coins.Value += stats.Power.Value
		stats.Power.Value = 0
	end
end)

What each part does

  • GetPlayerFromCharacter finds the player who stepped on the pad.
  • The pad adds all of the player's Power to Coins and then sets Power back to 0.

More detail

  • A pad is a flat part that players walk onto.
  • Put the pad flat on the floor. If it is too high, players cannot step onto it.
  • Walking onto the pad with 0 power does nothing. That is correct.
  • To test: click the crystal 10 times, walk onto the pad, and the player list shows Power 0 and Coins 10.
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 / 8

Add the upgrade pad

  1. Add another Part on the floor. Set Size to 8, 1, 8, turn on Anchored, make it blue and name it Upgrade.
  2. Add a Script to Upgrade and paste this code.
  3. Press Play, earn 25 coins and step on the pad. Every click now gives 2 power.
Upgrade > Script
local Players = game:GetService("Players")
local pad = script.Parent
local waiting = {}

pad.Touched:Connect(function(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if not player or waiting[player] then return end

	local price = player.Multiplier.Value * 25
	local coins = player.leaderstats.Coins
	if coins.Value < price then return end

	waiting[player] = true
	coins.Value -= price
	player.Multiplier.Value += 1

	task.wait(1)
	waiting[player] = nil
end)

What each part does

  • The price is the player's Multiplier times 25, so each upgrade costs more than the one before.
  • The waiting table stops one long step on the pad from buying many upgrades at once.
  • After the purchase the Multiplier goes up by 1.

More detail

  • Put the pad a few steps away from the sell pad, so players do not buy by accident.
  • The first upgrade costs 25 coins. After it, Coins drops by 25 and one click gives 2 power.
  • With fewer coins than the price, the pad does nothing. Step off, earn more and come back.
  • The 1 second pause is why holding still on the pad buys only one upgrade at a time.
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 / 8

Label the pads

  1. Hover over Sell, click + and add a BillboardGui. Set its Size to {0, 200}, {0, 50} and its StudsOffset to 0, 4, 0.
  2. Add a TextLabel into the BillboardGui. Set its Size to {1, 0}, {1, 0}, turn on TextScaled and type this text: SELL
  3. Do the same for Upgrade with the text: UPGRADE
  4. Do the same for Crystal with the text: CLICK ME. Use a StudsOffset of 0, 7, 0 there, so the label floats above the crystal.

More detail

  • 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 word and press Enter.
  • A faster way: click the finished BillboardGui in Explorer, press Ctrl+C, click the next part and press Ctrl+Shift+V. Then change only the text.
  • The labels help new players understand the game without any explanation.
Tip. A BillboardGui always turns to face the camera, so players can read it from any side.
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 / 8

Test the loop

  1. Press F5. Click, sell, upgrade, and repeat.
  2. Check that the upgrade price grows: 25 coins, then 50, then 75.
  3. Press Shift+F5 to stop. If something fails, open the Output window from the Window menu and read the red text.

More detail

  • Count your clicks. With Multiplier 1, ten clicks give 10 power.
  • After the first upgrade ten clicks give 20 power, and after the second 30.
  • Changes you make while the game is running are lost when you stop. Press Shift+F5 first, then edit.
  • In the Output window, click a red line and Studio opens the script at the line with the error.
Common mistake. The pad buys nothing: you need at least 25 Coins, not 25 Power. Sell first.
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 / 8

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 coins are 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

  • Add a second crystal that gives 5 power per click but stands far away.
  • Make the upgrade price double every time. Hint: 25 * 2 ^ (player.Multiplier.Value - 1)
  • Make the crystal a little bigger on every click. Hint: change crystal.Size