Converting JumpHeight to JumpPower

I’m working on bounce pads for my platformer, and my idea is to have their bounce height be controllable by setting how many studs it should bounce upward; problem is i don’t know how much force should be applied for a specific bounce height and workspace gravity.

So far, i have found nothing on the DevForum.

this is an example of a script that launches you exactly 100 studs up when you press Q
(local script in StarterCharacterScripts)

local UserInputService = game:GetService("UserInputService")

local height = 100 --> studs

local character = script.Parent
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local mass = humanoidRootPart.AssemblyMass
local gravity = workspace.Gravity

UserInputService.InputBegan:Connect(function(input, processed)
	
	if processed then
		return
	end
	
	if input.KeyCode ~= Enum.KeyCode.Q then
		return
	end
	
	local velocity = math.sqrt(2 * gravity * height) * mass
	humanoidRootPart:ApplyImpulse(Vector3.yAxis * velocity)

end)
2 Likes