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

Thats okay! Nobody is perfect.

The created coroutine is automatically garbage collected when completed, so thread buildup isnā€™t a problem. Fun fact, scripts in Roblox are actually coroutines themselves.

In addition, loops are calling actions in this case more often. Humanoid is only setting the jump to true when it lands, while the loop does it every wait(0.1)+tick()*2 seconds.

Itā€™s best to have games in Lua, both in-roblox and out, use the least amount of loops with yielding methods. Events are called less and are much more accurate, therefore saving a ton of memory.

However, for creating some connection events, be weary of manual garbage collection!


@Koala_Helper I opened the script in studio and found my issues. I now use .Changed instead of .StateChanged

-- // Constants
local Button = script.Parent --// Change this to what u need
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
	if IsJumping then
		humanoid.Jump = true
	end
end

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

humanoid.Changed:Connect(function()
	if IsJumping and humanoid.Jump == false then
		humanoid.Jump = true
	end
end)
2 Likes

It is possible. Thereā€™s a property of the Humanoid called Jump, once set to true the character will automatically jump.

Iā€™ll try thatā€¦

1 Like

Does it work? If not, I can help a bit more :slight_smile:

It didnā€™t work so far. I will keep trying.