Stage 8: Spinning KillBricks
Prerequisites: Before You Dive In!
Prepare yourselves, brave adventurers, as you stand on the brink of Stage 8! But first, ensure you've conquered the twists and turns of the preceding challenges.
1. Intro
Lay the groundwork for your coding conquest.
2. Setup
Equip yourself with the necessary tools and knowledge.
3. Stage 1: Ascending Walls
Scale new heights and overcome obstacles.
4. Stage 2: Sphere Stairs
Navigate the spherical staircase with finesse.
5. Stage 3: Plank Walkway
Balance and coordination are key on this precarious path.
6. Stage 4: KillBrick Path
Dodge deadly obstacles in this challenging terrain.
7. Stage 5: Fireball Footpath
Brave the fiery path and emerge victorious.
8. Stage 6: Military Minefield
Navigate through hidden dangers and traps.
9. Stage 7: Rolling Rocks
Roll with the punches and conquer the rocky terrain.
With each victory, you edge closer to the ultimate test: the Spinning KillBrick challenge!ðð
Objective ð§ðŋâ
Prepare to be swept into the heart-pounding chaos of Stage 8: Spinning Killbricks! Feel the rush as you plunge into a whirlwind of motion and strategy.
Description ððŠķâ
Ready to take on the ultimate challenge? Let's dive into the whirlwind of Stage 8: Spinning Killbricks! Prepare to push your limits as you experiment with different speeds and directions, navigating through a maze of spinning obstacles. Are you up for the challenge?
We are going to create a script that makes a part in Roblox spin continuously and cause any player who touches it to lose all their health. Here's what we want to accomplish:
1. Spin the Part:
The part will spin around smoothly.
2. Detect Touch:
The script will detect when a player touches the spinning part.
3. Affect the Player:
If a player touches the part, their health will be set to 0.
By doing this, we will create a spinning part that creates a challenge for players in the game.
Instructions and Code Logic ððâ
Step 1 - Set Up the Starting Variablesâ
-
Create a variable for the part by setting it to the
Parent
of the script. -
Create a variable for the speed of the spin (
spinSpeed
).
Step 2 - Create the Functionsâ
-
Define a function named
rotatePart
that spins the part. -
Inside the function, update the part's rotation using
CFrame
and thespinSpeed
. -
Define a function named
onPartTouched
that checks if something touching the part is a player. -
Inside the function, if the part that touched has a "Humanoid" (indicating a player), set the player's health to 0.
-
Use the
RunService.Heartbeat
event to call therotatePart
function continuously, making the part spin. -
Connect the
onPartTouched
function to the part'sTouched
event to detect when it is touched.
Putting It All Together ð§ðĐâ
-
Start by setting up your spinning part and spin speed.
-
Define a function named
rotatePart
to make the part spin. -
Define a function named
onPartTouched
to handle when the part is touched. -
Use the
RunService.Heartbeat
event to call therotatePart
function continuously. -
Connect the
onPartTouched
function to the part'sTouched
event.
Medium: Kill bricks that remove body parts when they touch!
Description ððŠķ
We are going to create a script that makes a part in Roblox spin continuously. The spin direction and speed will change randomly, and the part will reduce the health of any player who touches it and destroy the touched part. Here's what we want to accomplish:
1. Spin the Part:
The part will spin around smoothly.
2. Change Spin Properties:
The direction and speed of the spin will change randomly.
3. Detect Touch:
If a player touches the part, their health will be reduced, and the touched part will be destroyed.
By doing this, we will create a dynamic and interactive spinning part in the game.
Instructions and Code Logic ðð
Step 1 - Set Up the Starting Variables
-
Create a variable for the spinning part by setting it to the
Parent
of the script. -
Get the
RunService
from the game to connect to the Heartbeat event. -
Set the initial direction of the spin (1 for clockwise, -1 for counterclockwise).
-
Set the initial speed of the spin in degrees per frame.
Step 2 - Create a Function
-
Define a function named
rotatePart
. -
Inside the function, rotate the part around the Y-axis by the spin speed.
-
Define a function named
onPartTouched
that takes a part (hit
) as an argument. -
Inside the function, check if the part that touched has a humanoid (indicating a player).
-
If it does, reduce the player's health by 10 and destroy the touched part.
-
Define a function named
changeSpinProperties
. -
Inside the function, randomly set the direction to 1 (clockwise) or -1 (counterclockwise).
-
Randomly set the spin speed between 1 and 10 degrees per frame.
-
Connect the
rotatePart
function to the Heartbeat event so it runs every frame. -
Connect the
onPartTouched
function to theTouched
event for the spinning part.
Step 3 - Create an Infinite Loop
-
Create a loop that runs forever using
while true do
. -
Inside the loop, call the
changeSpinProperties
function to update the spin properties. -
Use the
wait
function to pause the loop for a random time between 1 and 4 seconds. -
The loop will automatically start running and changing the spin properties.
Putting It All Together ð§ðĐ
-
Start by setting up your spinning part and initial properties.
-
Define functions to handle rotation, player collisions, and changing spin properties.
-
Connect the functions to the appropriate events.
-
Create an infinite loop to change the spin properties periodically.
Hard: Kill bricks that randomly change speed and direction!
Description ððŠķ
We are going to create a script that makes a part in Roblox spin continuously. The spin direction and speed will change randomly, and the part will reduce the health of any player who touches it. Here's what we want to accomplish:
1. Spin the Part:
The part will spin around smoothly.
2. Change Spin Properties:
The direction and speed of the spin will change randomly every few seconds.
3. Detect Touch:
If a player touches the spinning part, their health will be reduced.
By doing this, we will create a dynamic and interactive spinning part in the game.
Instructions and Code Logic ðð
Step 1 - Set Up the Starting Variables
-
Create a variable for the spinning part by setting it to the
Parent
of the script. -
Get the
RunService
from the game to connect to the Heartbeat event. -
Set the initial direction of the spin (1 for clockwise, -1 for counterclockwise).
-
Set the initial speed of the spin in degrees per frame.
Step 2- Create a Function
-
Define a function named
rotatePart
. -
Inside the function, rotate the part around the Y-axis by the spin speed.
-
Define a function named
onPartTouched
that takes a part (hit
) as an argument. -
Inside the function, check if the part that touched has a humanoid (indicating a player).
-
If it does, reduce the player's health by 50.
-
Define a function named
changeSpinProperties
. -
Inside the function, randomly set the direction to 1 (clockwise) or -1 (counterclockwise).
-
Randomly set the spin speed between 1 and 10 degrees per frame.
-
Connect the
rotatePart
function to the Heartbeat event so it runs every frame. -
Connect the
onPartTouched
function to theTouched
event for the spinning part.
Step 3 - Create an Infinite Loop
-
Create a loop that runs forever using
while true do
. -
Inside the loop, call the
changeSpinProperties
function to update the spin properties. -
Use the
wait
function to pause the loop for a random time between 1 and 4 seconds.
Putting It All Together ð§ðĐ
-
Start by setting up your spinning part and initial properties.
-
Define functions to handle rotation, player collisions, and changing spin properties.
-
Connect the functions to the appropriate events.
-
Create an infinite loop to change the spin properties periodically.
Kudos, fearless adventurers! You've triumphed over the whirlwind of challenges in Stage 8! Now, brace yourselves as we journey onward to conquer even greater heights in Stage 9! ð