Bind function to mobile jump button

You can detect when the user starts holding it an when they release it with GuiButton.MouseButton1Down and GuiButton.MouseButton1Up events. This was mentioned here.

Here’s an example.

local Players = game:GetService("Players")
local plr = Players.LocalPlayer

-- All these WaitforChilds might not be necessary.
local jumpButton = plr:WaitForChild("PlayerGui"):WaitForChild("TouchGui"):WaitForChild("TouchControlFrame"):WaitForChild("JumpButton")

local function startedToHold()
    print("User started to hold the jump button.")
end

local function released()
    print("User released the jump button")
end

jumpButton.MouseButton1Down:Connect(startedToHold)
jumpButton.MouseButton1Up:Connect(released)
7 Likes