Sign in
Home
Online Classes
Instructors
Tutorials
☰
Register
Sign in
Online Classes
Instructors
Tutorials
1. Open Roblox Studio and Setup a New Project
2. Set Up Coin
3. Add a Script to ServerScriptService
4. Make CreateCoin Function
5. Closer Look at CreateCoin( ) (c)
6. Add a loop to create multiple coins
7. Test Out Your Code
8. Update CreateCoin( )
9. Test Out Your Code
10. Make the Coins 'Collectable'
11. Test Out Your Game
12. Add Sound Effect (Optional)
Project 369: Collecting Coins
4. Make CreateCoin Function
Create a function called "CreateCoin" that will hold the code that creates a single coin.
Starting point file for this challenge
Hint: show steps
Steps
1. Create a function called 'CreateCoin'
Hint: show details
Create a function called 'CreateCoin' that does not have any parameters.
function CreateCoin()
Hint: show image
Hint: show code
2. Add an 'end' to the function
Hint: show details
Hit return on your keyboard after the parentheses to and an 'end' statement to your function.
function CreateCoin() end
Hint: show image
Hint: show code
3. Create local variable 'coin'
Hint: show details
Inside the function, create a local variable called 'coin'.
local coin
Hint: show image
Hint: show code
4. Make 'coin' a new instance of part
Hint: show details
Set 'coin' to a new instance of a part. At this point it’s just a blank, generic part.
local coin = Instance.new("Part", workspace)
Hint: show image
Hint: show code
5. Set the coin at a random position on the ground
Hint: show details
Set the coin’s position to a random x and z position, but keep the y position at 0. This keeps the coin on the ground.
coin.Position = Vector3.new(math.random(100), 0, math.random(100))
Hint: show image
Hint: show code
×
×
Provide your email address for immediate project access
Email
Check your email for instructions on how to create a full DA account