How do i make build up speed?

i made a jump script, which is like a gmod bhop thingy but i want it to make build up speed, everytime i keep jumping, my speed goes faster or velocity something, any ideas? oh heres code if needed

uis.InputBegan:Connect(function(input)


	if isKeyPressed(Enum.KeyCode.Space ) and isKeyPressed(Enum.KeyCode.LeftShift )  then
		if isKeyPressed(Enum.KeyCode.W ) then
			if not bhopped then
				bhopped = true;

				Character.Humanoid.JumpPower = 0
				debris:AddItem(bodyvelocity, 0.01)


				print('linearvelocity added')
				



				Character:WaitForChild("HumanoidRootPart").Velocity = Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 130 + Vector3.new(0, 5, 0);
				bodyvelocity.Velocity = Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 175 + Vector3.new(0, 5, 0);
				bodyvelocity.MaxForce = Vector3.new(1000,0,1000)
				game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 100

				task.wait(0.5);
				bhopped = false;
				game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
				--bodyvelocity:Remove()
				--bodyvelocity:Destroy()
				-- bodyvelocity.VectorVelocity = Vector3.new(0,0,0)
				bodyvelocity.Velocity = Vector3.new(0,0,0)
				bodyvelocity.MaxForce = Vector3.new(0,0,0)
				print('linearvelocity changed to 0')

				Character.Humanoid.JumpPower = 50
				--local StartTime 
			end;
		end;
	end
end);

make a bool variable SpaceHold = false. When presses space, make it true, when releases make it false. On :HumanoidStateChanged(Landed) see if spacehold is true, add to the speed, if it is false, reset the speed

do you have an example? im kinda confused sorry haha

Im not gonna give you a script, write your own.

To simplify the idea, use :HumanoidStateChanged. If the state is “Landed”, it means the player just landed from a jump. When player lands, check if he’s holding the space, if yes, add speed, if no, reset the speed.

This can be a problem since you’re only checking if the space is held. You should check for if the player is moving while jumping, otherwise the player can gain a lot of speed just by standing still and I know that isn’t supposed to be possible when bhopping.

1 Like