How in the world do I hide the jump button?

I’ve been trying so long, so please don’t take this as a rant. I’m just really frustrated.
Here’s my script. It’s parented to StarterGUI, so it runs. I’ve printed and it works. It’s basically a combination of all of the workarounds I’ve seen on the Internet.

-- this script is a final attempt at removing jumping (i hate mobile)
local cas = game:GetService("ContextActionService")
local rs = game:GetService("RunService")

local plr = game.Players.LocalPlayer

plr.CharacterAdded:Wait()
plr:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)

script.Parent:WaitForChild("TouchGui")
	:WaitForChild("TouchControlFrame")
	:WaitForChild("JumpButton")
	:Destroy()

local timeout = 10
local timeCur = 0
local connection : RBXScriptConnection	
connection = rs.Heartbeat:Connect(function(step)
	timeCur += step
	if timeCur > timeout then connection:Disconnect() end
	if cas:GetAllBoundActionInfo()["jumpAction"] then
		print("yay")
		cas:UnbindAction("jumpAction")
		if connection.Connected then connection:Disconnect() end
	end
end)

Why does this not hide the jump button? Is there a specific thing I have to do?

1 Like

I read from this post in the last reply that if you set JumpPower to 0, then it will be disabled automatically. Otherwise, delete the jump button itself.
From another article, the jump button should be at Player.PlayerGui.TouchGui.TouchControlFrame.JumpButton.

3 Likes

It’s absolutely stupid that that’s the one that worked, and I didn’t try that one. I thought it wouldn’t.

I saw that reply, thank you for pointing me to the fact that it actually works.
Have a good day.

1 Like