Menu
CoddyTech

Jump Pad

Part of the Roblox Game Scripting section of Coddy's Lua journey. Lesson 18 of 24.

JumpHeight is how high a character jumps, in studs. The default is 7.2, about the height of a character.

Older games use JumpPower instead: the speed a character leaves the ground with. A new Roblox place ignores JumpPower unless UseJumpPower is turned on (in Studio: StarterPlayer, CharacterUseJumpPower), so when a JumpPower script from a tutorial does nothing, this is why. JumpHeight is the simpler one: the number is the height.

A power-up that lasts a while needs to undo itself later. task.delay(seconds, function) runs the function after that many seconds, without pausing the rest of your code:

humanoid.WalkSpeed = 30
task.delay(10, function()
	humanoid.WalkSpeed = 16
end)
print("Boost on")

Boost on prints at once; the speed goes back to 16 ten seconds later.

The pad only changes a property. The player still presses Space to jump.

challenge icon

Challenge

Medium

The yellow ledge is 14 studs tall, about twice a normal jump. The blue pad in front of it is the jump pad, and this script is inside it.

When a character touches the pad:

  1. set its JumpHeight to 20
  2. 5 seconds later, set it back to 7.2

Press Play, step on the pad, run at the ledge and jump. Then Check.

Try it yourself

local pad = script.Parent

pad.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		-- 1. Let this player jump 20 studs high
		-- 2. 5 seconds later, back to the normal 7.2
	end
end)
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Roblox Game Scripting

Practice on your own: Online Lua compiler