Stage 8: Spinning KillBricks
Prerequisites: Before You Dive In!
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!
Hard: Kill bricks that randomly change speed and direction!
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! ð