Sign in
Home
Online Classes
Instructors
Tutorials
☰
Register
Sign in
Online Classes
Instructors
Tutorials
1. Open Roblox Studio and load the starter kit
2. Make some more Exploder Parts
3. (Concept Exercise) Hierarchies
4. Add a script to the ServerScriptService
5. Tell the script to find all your exploder parts
6. Create a new instance of an explosion
7. Create an explode function
8. Test it out
9. Randomize the explosion
10. Give players a warning before exploding
11. Create your exploder course
Project 327: Exploder Course
5. Tell the script to find all your exploder parts
The reason we put this script inside of ServerScriptStorage is so that this singular script can act behind the scenes and find ALL of your exploder parts.
Starting point file for this challenge
Hint: show steps
Steps
1. Tell the game to find everything in the Workspace folder
Hint: show details
In other words, tell the game to find all the children in the Workspace parent folder.
game.workspace:GetChildren()
Hint: show image
Hint: show code
2. Keep track of the children
Hint: show details
Label all the children as a variable called "children"
children = game.workspace:GetChildren()
Hint: show image
Hint: show code
3. Create a forever loop
Hint: show details
In Lua, this is made by typing "while true do."
Then, hit return to create an end to the loop.
while true do end
Hint: show image
Hint: show code
4. In the forever loop, create a for loop to cycle through the children
Hint: show details
A for loop is used to cycle through a list. Create this inside the forever loop.
We just made a list of everything in the Workspace folder, so we need to cycle through it.
Hit return to create an end to this loop.
for _, child in pairs(children) do end
Hint: show image
Hint: show code
5. Inside the for loop, check for any children named "Exploder"
Hint: show details
In other words, find anything in the Workspace folder called "Exploder."
if child.Name == "Exploder" then end
Hint: show image
Hint: show code
6. If there's a child named "Exploder" then tell it to explode
Hint: show details
For now, we'll tell it to run a function called "Explode" with the parameter of "child"
Roblox might give you an error, because we haven't actually made an "Explode" function yet! We will, soon!
Explode(child)
Hint: show image
Hint: show code
7. Add a delay after the for loop, inside the forever loop
Hint: show details
Without this 1 second delay, Roblox would be running this code at super speed and just crash the game.
wait(1)
Hint: show image
Hint: show code
8. Lists in Roblox
Hint: show details
This gif shows show tables work in Roblox.
Hint: show image
×
×
Provide your email address for immediate project access
Email
Check your email for instructions on how to create a full DA account