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?
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.
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)
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)