🐾 My First Roblox Studio Game · Episode 3 of 6 · See All Episodes
🐾 Episode 3 · Click Mechanics · DataStores

Pet Clicker!
Simulator Game

Build a pet simulator where you click to earn coins, hatch egg pets and level up the same style as the most popular Roblox games ever made!

👶 Ages 8+ ⏱️ ~1.5 Hours 🟦 Roblox Studio ✓ Free
0 XP
Level 1
🔥0
Your Progress0 / 11 steps
1
🌍
Build the World
Set up the map — a cute grassy area to collect coins in
Active
🎯
Goal for this step

Create a colourful open world with a click zone where coins will spawn.

👨‍👧
Parent note: Open Roblox Studio → Baseplate template. This episode introduces ClickDetectors — a really fun mechanic that kids love!
  • 1Open Roblox Studio → Baseplate template. In Explorer, click Baseplate and set its BrickColor to Bright green and Material to Grass.
  • 2Add a large Part (size 40, 1, 40) as a central plaza BrickColor Institutional white, Material SmoothPlastic. Position it in the middle.
  • 3Add a SpawnLocation on the plaza.
  • 4Add some decorative trees: tall thin cylinders (trunks) with green spheres on top (leaves). Group each as Tree.
  • 5Add a sky: in Explorer find Lighting → right-click → Insert Object → Sky. Pick any sky preset you like!
✏️
Fill in the Blanks
+15 XP
To make the ground look like grass, we change the Baseplate's BrickColor to and set the Material to .
🧠
Knowledge Check
+15 XP
Where do you find the Sky object to add a sky to your game?
AInside ServerScriptService
BRight-click Lighting in Explorer → Insert Object → Sky
CIn the Toolbox under Models
2
🪙
Coins & Leaderboard
Set up the Coins and Gems values that players earn
Locked
🎯
Goal for this step

Create Coins and Gems values on each player that show on the leaderboard.

  • 1In ServerScriptService, right-click → Insert Object → Script. Name it PlayerSetup. Paste:
PlayerSetup Script
game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder") stats.Name = "leaderstats" stats.Parent = player local coins = Instance.new("IntValue") coins.Name = "Coins" coins.Value = 0 coins.Parent = stats local gems = Instance.new("IntValue") gems.Name = "Gems" gems.Value = 0 gems.Parent = stats end)
💻
Code Challenge
+20 XP
Fill in the blanks to create a Coins value on the leaderboard:
local coins = Instance.new("") coins.Name = "" coins.Parent = stats
💡 Hint: Coins are whole numbers, so we use an IntValue. The Name must match exactly.
🧠
Knowledge Check
+15 XP
The folder that holds leaderboard values must be named what?
AStats
BPlayerStats
Cleaderstats
3
👆
Clickable Coin!
Create a glowing coin that players click to earn money
Locked
🎯
Goal for this step

Build a coin that players can click — each click earns 1 coin and bounces the part.

Build the coin

  • 1Add a Part. Right-click it → Insert Object → SpecialMesh. Set MeshType to Cylinder. Resize the part to 0.5, 3, 3 a flat coin shape.
  • 2Set BrickColor to Bright yellow, Material to Neon. Set Anchored to true. Name it CoinClick. Place it on the plaza.
  • 3Right-click CoinClick → Insert Object → ClickDetector. This makes it clickable!
  • 4Right-click CoinClick → Insert Object → Script. Paste:
Script (inside CoinClick)
local coin = script.Parent local detector = coin:WaitForChild("ClickDetector") local TweenService = game:GetService("TweenService") -- Spin the coin local spinInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1) TweenService:Create(coin, spinInfo, {CFrame = coin.CFrame * CFrame.Angles(0, math.pi*2, 0)}):Play() detector.MouseClick:Connect(function(player) player.leaderstats.Coins.Value += 1 end)
💡
Change += 1 to += 5 to earn 5 coins per click. Later you can add a multiplier upgrade!
True or False?
+15 XP
A ClickDetector is needed to make a Part clickable in-game.
Setting a Part's Material to Neon makes it glow.
The MouseClick event gives you the Part that was clicked, not the player.
🧠
Knowledge Check
+15 XP
What does player.leaderstats.Coins.Value += 1 do?
AAdds 1 to the player's Coins value on the leaderboard
BCreates a new coin in the workspace
CSets the player's Coins to exactly 1
4
🥚
Build the Egg!
Create a giant egg that players can buy to hatch a pet
Locked
🎯
Goal for this step

Create a big colourful egg that costs 10 coins to hatch spawning a pet!

Make the egg shape

  • 1Add a Part. Right-click → Insert Object → SpecialMesh. Set MeshType to Sphere. Resize the part to 4, 5, 4 for an egg shape.
  • 2BrickColor: Pastel blue, Material: SmoothPlastic. Name it Egg. Set Anchored = true. Place it near the plaza.
  • 3Add a BillboardGui to Egg with a TextLabel that says 🥚 Hatch! Cost: 10 Coins. (StudsOffset 0, 4, 0)
  • 4Right-click Egg → Insert Object → ClickDetector.
  • 5Right-click Egg → Insert Object → Script. Paste:
Script (inside Egg)
local egg = script.Parent local detector = egg:WaitForChild("ClickDetector") local cost = 10 local pets = {"🐶 Dog", "🐱 Cat", "🐸 Frog", "🦊 Fox", "🐼 Panda"} detector.MouseClick:Connect(function(player) local coins = player.leaderstats.Coins if coins.Value >= cost then coins.Value -= cost local pet = pets[math.random(#pets)] print(player.Name .. " hatched: " .. pet) else print(player.Name .. " needs more coins!") end end)
📖
The pet is randomly chosen from the list. You can add more pets or change the emoji names to whatever animals you want!
🔮
Predict What Happens
+15 XP
A player has 8 Coins and clicks the Egg that costs 10 Coins.

What happens?
AThe egg hatches but the player goes to -2 coins
BNothing happens — the if check blocks it because 8 is not >= 10
CThe game crashes with an error
🧠
Knowledge Check
+15 XP
What does math.random(#pets) do?
AAlways picks the first pet in the list
BRemoves a random pet from the list
CPicks a random number from 1 to the length of the pets list
5
🐶
Pet Appears!
Make a real 3D pet follow the player after hatching
Locked
🎯
Goal for this step

When a pet hatches, a coloured ball appears and follows the player around.

Update the egg script

  • 1Replace the egg script with this expanded version that spawns a following pet:
Egg Script (with following pet)
local egg = script.Parent local detector = egg:WaitForChild("ClickDetector") local cost = 10 local petColors = { BrickColor.new("Bright brown"), BrickColor.new("Bright orange"), BrickColor.new("Lime green"), BrickColor.new("Bright red"), BrickColor.new("White") } local function spawnPet(player) local character = player.Character if not character then return end local root = character.HumanoidRootPart local pet = Instance.new("Part") pet.Shape = Enum.PartType.Ball pet.Size = Vector3.new(2,2,2) pet.BrickColor = petColors[math.random(#petColors)] pet.Material = Enum.Material.SmoothPlastic pet.Position = root.Position + Vector3.new(3,0,0) pet.Parent = workspace -- Follow the player game:GetService("RunService").Heartbeat:Connect(function() if root and pet.Parent then pet.Position = pet.Position:Lerp( root.Position + Vector3.new(3, 0, 0), 0.1) end end) end detector.MouseClick:Connect(function(player) local coins = player.leaderstats.Coins if coins.Value >= cost then coins.Value -= cost spawnPet(player) end end)
🐾
The pet smoothly follows you using Lerp (a maths trick for smooth movement). You can hatch multiple pets and they'll all follow you!
✏️
Fill in the Blanks
+15 XP
The pet follows the player using a function called which creates movement between two positions.
🧠
Knowledge Check
+15 XP
Which Roblox service runs code every frame to update the pet's position?
ADataStoreService
BRunService (Heartbeat)
CTweenService
6
📱
Coins GUI
Show a big coin counter on screen so players always see their wealth
Locked
🎯
Goal for this step

Add an on-screen GUI that shows coins updating in real time.

  • 1In StarterGui, add a ScreenGui → name it HUD.
  • 2Add a Frame inside HUD. Set Size to {0, 200}, {0, 60}. Position: {0.5, -100}, {0, 10} (top centre). BackgroundColor3: dark blue (0,0,0.2). BackgroundTransparency: 0.3. UICorner: add UICorner with CornerRadius 0.3.
  • 3Add a TextLabel inside the Frame. Size {1,0},{1,0}. Text: 🪙 0 Coins. TextScaled: true. Font: GothamBold. BackgroundTransparency: 1. TextColor: white.
  • 4Add a LocalScript inside HUD:
LocalScript (inside HUD)
local player = game.Players.LocalPlayer local label = script.Parent.Frame.TextLabel local coins = player:WaitForChild("leaderstats"):WaitForChild("Coins") local function update(val) label.Text = "🪙 " .. tostring(val) .. " Coins" end update(coins.Value) coins.Changed:Connect(update)
💻
Code Challenge
+20 XP
Fill in the blanks to update the coin label when coins change:
local coins = player:WaitForChild("leaderstats"):WaitForChild("") coins.:Connect(update)
💡 Hint: We listen for the "Changed" event on the Coins value.
🧠
Knowledge Check
+15 XP
A LocalScript inside StarterGui runs on the...
APlayer's computer (client side)
BRoblox server only
CBoth the server and client at the same time
7
⬆️
Click Upgrade Shop
Let players buy a multiplier that earns more per click
Locked
🎯
Goal for this step

Add an upgrade that costs 50 coins and doubles coins per click forever.

  • 1Add a Part, size 6, 0.5, 6, BrickColor Bright violet, Material Neon. Name it UpgradePad. Anchored = true. Place it near the coin.
  • 2Add a BillboardGui with TextLabel: ⬆️ 2x Click! Cost: 50.
  • 3Add a ClickDetector to UpgradePad.
  • 4Add a Script inside UpgradePad:
Script (inside UpgradePad)
local pad = script.Parent local detector = pad:WaitForChild("ClickDetector") local upgradedPlayers = {} detector.MouseClick:Connect(function(player) if upgradedPlayers[player.Name] then print("Already upgraded!") return end local coins = player.leaderstats.Coins if coins.Value >= 50 then coins.Value -= 50 upgradedPlayers[player.Name] = true -- Store multiplier as attribute on player player:SetAttribute("ClickMultiplier", 2) pad.BrickColor = BrickColor.new("Bright green") print(player.Name .. " bought 2x click!") end end)
  • 5Now update the CoinClick script so clicks use the multiplier: change += 1 to += (player:GetAttribute("ClickMultiplier") or 1).
🔢
Put It In Order
+15 XP
Click these in the correct order to build the upgrade system:
Update the CoinClick script to use GetAttribute("ClickMultiplier")
Add a Part named UpgradePad with a ClickDetector
Add a Script that charges 50 coins and sets the multiplier attribute
🧠
Knowledge Check
+15 XP
Why do we use upgradedPlayers[player.Name] to track who bought the upgrade?
ATo make the upgrade cost more each time
BTo prevent the same player from buying it more than once
CTo display the upgrade on the leaderboard
8
🌟
Coin Pop Animation
Make floating +1 text appear every time you click
Locked
🎯
Goal for this step

Add satisfying floating "+1" text that pops up above the coin every click.

  • 1In ReplicatedStorage, right-click → Insert Object → BillboardGui. Name it CoinPop. Set Size {0,80},{0,40}. Add a TextLabel inside: Text +1, TextScaled true, Font GothamBold, TextColor yellow, BackgroundTransparency 1.
  • 2Add a LocalScript inside the CoinClick part (alongside the existing Script) — LocalScripts run on the player's screen for visual effects:
LocalScript (inside CoinClick — visual only)
local coin = script.Parent local detector = coin:WaitForChild("ClickDetector") local popTemplate = game.ReplicatedStorage:WaitForChild("CoinPop") detector.MouseClick:Connect(function() local pop = popTemplate:Clone() pop.Adornee = coin pop.StudsOffset = Vector3.new(math.random(-2,2), 4, 0) pop.Parent = coin task.delay(0.6, function() pop:Destroy() end) end)
True or False?
+15 XP
A BillboardGui floats above a Part in the 3D world.
The CoinPop template should be stored inside ServerScriptService.
task.delay(0.6, function) waits 0.6 seconds before running the function.
🧠
Knowledge Check
+15 XP
Why do we use :Clone() on the CoinPop template?
ATo delete the original template
BTo make the popup bigger each time
CTo make a copy so the original stays in ReplicatedStorage for reuse
9
💾
Save Data
Make coins and gem counts save so players keep their progress
Locked
🎯
Goal for this step

Add DataStore saving so coins persist between sessions.

⚠️
Enable Home → Game Settings → Security → Enable Studio Access to API Services first!
  • 1Replace the PlayerSetup script with this saving version:
PlayerSetup (with DataStore)
local DS = game:GetService("DataStoreService") local store = DS:GetDataStore("PetSimData") game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder") stats.Name = "leaderstats"; stats.Parent = player local coins = Instance.new("IntValue") coins.Name = "Coins"; coins.Parent = stats local saved = store:GetAsync(player.UserId) coins.Value = saved or 0 end) game.Players.PlayerRemoving:Connect(function(player) store:SetAsync(player.UserId, player.leaderstats.Coins.Value) end)
💻
Code Challenge
+20 XP
Fill in the blanks to save and load player data:
local saved = store:(player.UserId) game.Players.:Connect(function(player) store:SetAsync(player.UserId, player.leaderstats.Coins.Value) end)
💡 Hint: GetAsync loads data, and PlayerRemoving fires when a player leaves.
🧠
Knowledge Check
+15 XP
What must you enable before DataStores work in Studio?
AGame Settings → Security → Enable Studio Access to API Services
BAdd a RemoteEvent to ReplicatedStorage
CPublish the game to Roblox first
10
🎨
Decorate & Polish
Make your simulator look amazing with colours and lighting
Locked
🎯
Goal for this step

Add atmosphere, decorations and polish to make your simulator feel professional.

👨‍👧
Parent note: Free build time! Let your child decorate however they want.
  • 1In Lighting (Explorer), set Brightness to 2, Ambient to a warm colour. Add a ColorCorrection effect with Saturation 0.2 for a vibrant look.
  • 2Add a SurfaceAppearance to the ground (Insert Object → SurfaceAppearance) and choose a grass texture.
  • 3Add more clickable coins in different spots each one earns coins. Make some float in the air!
  • 4Add more egg types a Golden Egg that costs 100 coins but has rarer pets!
  • 5Add a welcome sign using a Part with a SurfaceGui containing a TextLabel.
🔢
Put It In Order
+15 XP
Click these polish steps in the order you'd do them to add a glowing welcome sign:
Add a SurfaceGui to the Part, then put a TextLabel inside it
Insert a new Part and position it near the spawn area
Set the Part's Anchored property to true so it doesn't fall
Type your welcome message into the TextLabel's Text property
🧠
Knowledge Check
+15 XP
Which Lighting property makes your whole simulator brighter or darker?
ASaturation on a ColorCorrection effect
BBrightness on the Lighting service
CThe Material of the Baseplate
11
🌍
Publish Your Simulator!
Final test and share with friends
Locked
🎯
Goal for this step

Test everything, save and publish to Roblox.

  • 1Press Play. Click the coin to earn coins, hatch a pet, buy the upgrade.
  • 2Check the coin GUI updates correctly.
  • 3Check pet follows you around.
  • 4Press Stop, then File → Publish to Roblox. Set Privacy to Public.
  • 5Share the link!
True or False?
+15 XP
You should press Play to test the full game loop before publishing.
You must set your game's Privacy to Private for friends to play it.
Publishing uses File → Publish to Roblox in Roblox Studio.
🧠
Knowledge Check
+15 XP
What should you check during your full playthrough before publishing?
AOnly that the coin GUI shows up
BOnly that the pet hatches from the egg
CCoin earning, pet hatching, pet following, and upgrades all work together
🎉🐾🪙🥚🌟
You Built a Pet Simulator!

Amazing coins, egg hatching, pet following, upgrades and saving data. You're basically making the next big Roblox hit! Ready for Episode 4?

⚔️ Episode 4: Battle Arena → ⭐ 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