Lesson · with Tilt
Coins and Score
Add coins the player can collect and a score on screen, using the Touched event.
You need
- Roblox Studio
- A mouse is strongly recommended
Steps
Make a score label
In StarterGui insert a ScreenGui, then a TextLabel. Set its Text to Score: 0.
Make a coin
Insert a small yellow Part named Coin, anchored, with CanCollide off.
Script the touch
Add a Script to the coin: local coin = script.Parent coin.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then coin:Destroy() end end)
Count it
With your instructor, connect the coin to the score using a LocalScript or leaderstats, so the label goes up by 1.
Balance it
Place 5 coins. Put the hardest coin somewhere risky. Is it worth the risk?
Build task
One mechanic
Add ONE mechanic that makes your game yours: collect, avoid, race or build.
Finish line: Coins disappear when touched and your score changes.