Project 369: Collecting Coins

12. Add Sound Effect (Optional)

Add a sound effect that plays whenever a coin is collected.
Starting point file for this challenge

Steps

1. Open the Toolbox

Go to the 'Home' tab at the top of your Roblox Studio window and click on 'Toolbox'.

2. Select the Audio Category and Search for 'Coin'

Select 'Audio' from the drop-down and search for 'Coin'.

3. Pick a Sound Effect

Listen to the different sound effects and pick the one that you want to play whenever a player collects a coin. Click on the magnifying glass to open it.

4. Click 'Insert'

Click the 'Insert' button at the bottom of the sound's description to add the sound effect to your workspace.

5. Rename it "CoinSound'

Right click on the sound effect in the Explorer window and rename it 'CoinSound'.

6. Tell the game to play your sound when the coin is collected

Go into your code and add a line before 'item:Destroy()'. Find the sound effect using 'game.Workspace.CoinSound' and play the sound by applying the 'play()' method to it.
game.workspace.CoinSound:play()