Skip to main content

Stage 5: Fireball Cannon + player launcher

Course progressStage 5 of 10
~35 min
Before you start

Make sure the dash pad can carry you safely to Stage 5.

Build

a cannon path, cannon base, and cannon barrel

Learn

how the direction of a part can aim motion

Ship

a launcher that fires the player toward the next stage

The big idea

The cannon looks like decoration, but the target marker controls where it launches the player. Move the marker and the launch changes. That is a powerful idea: building and coding are connected.

New words
target marker
a small part that tells a script where to aim
barrel
the long part of a cannon that points where it fires
aim
point something toward the target

Build it

Step 1 — Build the cannon

Build this part

CannonPath

Block
Open recipe
Size
30 × 1 × 10
Color
Dark stone grey
Material
Concrete
Anchored
✓ Yes
Build this part

CannonBase

Block
Open recipe
Size
8 × 3 × 8
Color
Black
Material
Metal
Anchored
✓ Yes
Place
Centered on CannonPath
Build this part

CannonBarrel

Block
Open recipe
Size
4 × 4 × 12
Color
Really black
Material
Metal
Anchored
✓ Yes
Place
On top of CannonBase
Target
CannonTarget

Add one small marker part where the cannon should launch the player:

Build this part

CannonTarget

Block
Open recipe
Size
2 × 1 × 2
Color
Bright yellow
Material
Neon
Anchored
✓ Yes
Place
Near the Stage 6 landing

Make CannonTarget transparent if you want it hidden.

Step 2 — Script the launch

Insert a Script inside CannonBase:

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local base = script.Parent
local barrel = workspace:WaitForChild("CannonBarrel")
local target = workspace:WaitForChild("CannonTarget")
local launchEvent = ReplicatedStorage:WaitForChild("LaunchPlayer")
local LAUNCH_POWER = 110
local cooldown = {}

base.Touched:Connect(function(hit)
local character = hit.Parent
local root = character and character:FindFirstChild("HumanoidRootPart")
if not root then return end

local player = Players:GetPlayerFromCharacter(character)
if not player or cooldown[player] then return end

local direction = target.Position - barrel.Position
if direction.Magnitude == 0 then return end

cooldown[player] = true
launchEvent:FireClient(player, direction.Unit * LAUNCH_POWER)

task.delay(0.8, function()
cooldown[player] = nil
end)
end)

Press Play. Step onto the cannon base. Move CannonTarget and test again until the launch lands where you want.

Step 3 — Add the Stage 6 checkpoint

Place a SpawnLocation where the cannon lands. Add StageNumber = 6 and the matching Team. Give this checkpoint the same settings as Stage 1 (check AllowTeamChangeOnTouch, uncheck Neutral, match the pad's TeamColor to its Team), and uncheck AutoAssignable on the new Team so players always start at Stage 1.

Understand it

The server Script reads the direction from CannonBarrel to CannonTarget, checks a short per-player cooldown, then asks ParkourLaunchClient to apply one cannon blast on the player's character. That means the marker is the aim helper. Students can tune the game by moving an object, not rewriting a script.

Try this

Learning beat

Try this

Three short experiments. Predict before you run, then test your guess.

Predict first

What happens if CannonTarget is too high? What if it is too low?

Compare

Try a short launch and a long launch. Which feels more exciting and still fair?

Connect

What else in a game could use a part's direction to aim?

Test your stage

  • CannonBase launches the player.
  • Moving CannonTarget changes the launch.
  • The player can land near Stage 6.
  • Stage 6 checkpoint works.

If it breaks

  • I launch the wrong way. Move CannonTarget; the marker controls the launch direction.
  • I do not launch. Confirm the Script is inside CannonBase and CannonBarrel is named exactly.
  • The cannon detects me but does not move me. Make sure Stage 2's LaunchPlayer RemoteEvent and ParkourLaunchClient LocalScript still exist.
  • The cannon fires too many times. Check the cooldown table and task.delay(0.8, ...) lines.
  • I overshoot. Lower LAUNCH_POWER.
Coach notes

This stage has a high inspiration payoff. Spend time letting students aim and test. The visible loop is the learning.