Humanoid.JumpHeight = The height in studs, which the player can jump, example if keep this 100 studs, I will jump in the game I can jump 100 studs
Humanoid.Jump = Each time player jumps, this will become true, then after 1 second false, this is a bool value, it means true/false value
Humanoid = This is the main object in player’s character and its not a BasePart/Mesh/Model
So its just 2 steps
Tutorial
Step 1
Make a part, keep it in game.Workspace
Step 2
Add a script,
Check the script below
local canwork = true -- to avoid loops
local prevjumpheight = 0 -- this is to get back the player height to the height which was before jumping on trampoline
script.Parent.Touched:Connect(function(hit) -- event fires when some thing touches the trampoline
if hit.Parent:FindFirstChild("Humanoid") and canwork == true then -- if its a player who stepped
local humanoid = hit.Parent:FindFirstChild("Humanoid")
canwork = false -- now script wont run
prevjumpheight = hit.Parent:FindFirstChild("Humanoid").JumpHeight
humanoid.JumpHeight = 150 -- this is the height that the player can jump, we make it 150, so the player can jump high
humanoid.Jump = true -- we will make the player jump, so its like a trampoline
task.wait(2) -- when the player goes up the sky by 150 studs, we make the player height they can jump normal
humanoidd.JumpHeight = prevjumpheight -- again the player character jump height in studs become normal
canwork = true -- script runs again
end
end)
Step 3:
Enjoy! Tutorial is done
How this works:
This is a working trampoline, not a glitchy ones like in many games, this works good and does not look glitchy
I know that this is tutorial but here are some suggestions from me.
Don’t repeat hit.Parent:FindFirstChild("Humanoid") instead create a variable for it.
You shouldn’t use wait() as its probably gonna be deprecated, and there is already replacement for it which is task.wait().
You could optionally avoid nesting the if statement but that’s a personal preference.
Your prevjumpheight variable is not in use and its only being set but not read, and it doesn’t have to be a global variable.
local jumpPart = script.Parent
local jumpHeight = 150
local debounce = true
jumpPart.Touched:Connect(function(hit)
if not debounce then return end
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if not humanoid then return end
debounce = false
local previousJumpHeight = humanoid.JumpHeight
humanoid.JumpHeight = jumpHeight
humanoid.Jump = true
task.wait(2)
humanoid.JumpHeight = previousJumpHeight
debounce = true
end)
You don’t have to, its gonna retain its functionality and it will not be deprecated anytime soon, but what it really means is that for the future scripts/projects you should use task.wait() and other methods such as task.delay(), task.spawn() and etc.