Is it possible to make a gui that once clicked, it would make the player jump non stop (bhop) until clicked again?

Hello! My name is Koala_Helper.



Is it possible to make a gui once clicked it would make the player jump nonstop until clicked again? (Bhop)


I want to know gui once clicked it will make the player jump nonstop (Bhop) and it would keep that up until they clicked the gui again? My goal is to make a bunny hop (Bhop) challenge for my game. I just need to know if it is possible and how I should do it because for youtube nothing helps it's just a bhop game. Does anybody know if it's possible and if there is a developer forum that asks this but might have the code?
4 Likes

I don’t remember too much but, i think this property: Humanoid | Documentation - Roblox Creator Hub, when set to true, makes the character jump…

I just closed studio, so i can’t actually test it out, could you give it a try?

2 Likes

Okay… I will try to give it a try.

1 Like

When I click that link, this pops up.

Yes it’s definitely possible, you can use ChangeState() to force the humanoid into a jumping state, and you can used the StateChanged event to detect whenever the player finishes jumping to send him back into a jump.

Article on StateChanged:

Article on ChangeState:

Also if you aren’t familiar with functions and events yet you should read up on them.
Functions: Functions | Documentation - Roblox Creator Hub
Events: Events | Documentation - Roblox Creator Hub

4 Likes

Okay! I will try my best to do that

That’s meant to pop up, that’s an article on how Jump works.

Okay! I was just making sure. …

Yea.

humanoid.StateChanged:Connect(function(state)
   if isBhopping and state == Enum.HumanoidStateType.Landed then
      humanoid.Jump = true
   end
end)
2 Likes

That’s unoptimized code. I recommend not using loops when possible.
Otherwise, looks really organized (you don’t see that often)!

2 Likes

I will try it!!!

1 Like

If you want an alternative/edit, I can provide an edit to what @AsynchronousMatrix (who did a good job, thx)

-- // Constants
local Button = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")

-- // Variables
local IsJumping = false

-- // Functions
local function OnButtonActivated()
	IsJumping = not IsJumping
    humanoid = Character:WaitForChild("Humanoid")
end

-- // Binds
Button.Activated:Connect(OnButtonActivated)

humanoid.StateChanged:Connect(function(state)
   if IsJumping and state == Enum.HumanoidStateType.Landed then
      humanoid.Jump = true
   end
end)
3 Likes

Should I put them in the same script?

2 Likes

No, just one or the other.
I recommend using mine, as it uses less memory and will react faster.

4 Likes

Okay…

1 Like

Does it work with R6? That is what I have my game set to because so far it won’t work.

1 Like

It should. My code is untested, so let’s see what’s wrong.
Maybe this should work?

-- // Constants
local Button = script.Parent
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")

-- // Variables
local IsJumping = false

-- // Functions
local function OnButtonActivated()
	IsJumping = not IsJumping
    humanoid = Character:WaitForChild("Humanoid")
    if IsJumping then
        humanoid.Jump = true
    end
end

-- // Binds
Button.Activated:Connect(OnButtonActivated)

humanoid.StateChanged:Connect(function(state)
   if IsJumping and state == Enum.HumanoidStateType.Landed then
      humanoid.Jump = true
   end
end)
5 Likes

I will try that! I think that might work!

1 Like

Can you make a little video of it, I will make one to of what it is doing.

Here is the thing.
@iGottic
For some reason it is not working idk why.

Watch quick copy right music and I need to delete the video after you watch it.