function TouchJump.Enable(i)ExternallyEnabled=true enableButton()end function TouchJump.Disable(i)ExternallyEnabled=false disableButton()end function TouchJump.Create(k,i)if JumpButton then JumpButton:Destroy()JumpButton=nil end local Q=math.min(i.AbsoluteSize.x,i.AbsoluteSize.y)local y=Q<=500 local T=y and 70 or 120 JumpButton=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")JumpButton.Name="\074\117\109\112\066\117\116\116\111\110"JumpButton.Visible=false JumpButton.BackgroundTransparency=1 JumpButton.Image=TOUCH_CONTROL_SHEET JumpButton.ImageRectOffset=Vector2.new(176,222)JumpButton.ImageRectSize=Vector2.new(174,174)JumpButton.Size=UDim2.new(0,T,0,T)JumpButton.Position=y and UDim2.new(1,-(T*1.5-10),1,-T-20)or UDim2.new(1,-(T*1.5-10),1,-T*1.75)local Y=nil JumpButton.InputBegan:connect(function(i)if Y or i.UserInputType~=Enum.UserInputType.Touch or i.UserInputState~=Enum.UserInputState.Begin then return end Y=i JumpButton.ImageRectOffset=Vector2.new(0,222)MasterControl:SetIsJumping(true)end)OnInputEnded=function()Y=nil MasterControl:SetIsJumping(false)JumpButton.ImageRectOffset=Vector2.new(176,222)end JumpButton.InputEnded:connect(function(i)if i==Y then OnInputEnded()end end)GuiService.MenuOpened:connect(function()if Y then OnInputEnded()end end)if not CharacterAddedConnection then setupCharacterAddedFunction()end JumpButton.Parent=i end return TouchJump
--[[ Public API ]]
--
function TouchJump:Enable()
	ExternallyEnabled = true
	enableButton()
end

function TouchJump:Disable()
	ExternallyEnabled = false
	disableButton()
end

function TouchJump:Create(parentFrame)
	if JumpButton then
		JumpButton:Destroy()
		JumpButton = nil
	end

	local minAxis = math.min(parentFrame.AbsoluteSize.x, parentFrame.AbsoluteSize.y)
	local isSmallScreen = minAxis <= 500
	local jumpButtonSize = isSmallScreen and 70 or 120

	JumpButton = Instance.new("ImageButton")
	JumpButton.Name = "JumpButton"
	JumpButton.Visible = false
	JumpButton.BackgroundTransparency = 1
	JumpButton.Image = TOUCH_CONTROL_SHEET
	JumpButton.ImageRectOffset = Vector2.new(176, 222)
	JumpButton.ImageRectSize = Vector2.new(174, 174)
	JumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)

	JumpButton.Position = isSmallScreen and UDim2.new(1, -(jumpButtonSize * 1.5 - 10), 1, -jumpButtonSize - 20)
		or UDim2.new(1, -(jumpButtonSize * 1.5 - 10), 1, -jumpButtonSize * 1.75)

	local touchObject = nil
	JumpButton.InputBegan:connect(function(inputObject)
		--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
		--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
		if
			touchObject
			or inputObject.UserInputType ~= Enum.UserInputType.Touch
			or inputObject.UserInputState ~= Enum.UserInputState.Begin
		then
			return
		end

		touchObject = inputObject
		JumpButton.ImageRectOffset = Vector2.new(0, 222)
		MasterControl:SetIsJumping(true)
	end)

	OnInputEnded = function()
		touchObject = nil
		MasterControl:SetIsJumping(false)
		JumpButton.ImageRectOffset = Vector2.new(176, 222)
	end

	JumpButton.InputEnded:connect(function(inputObject)
		if inputObject == touchObject then
			OnInputEnded()
		end
	end)

	GuiService.MenuOpened:connect(function()
		if touchObject then
			OnInputEnded()
		end
	end)

	if not CharacterAddedConnection then
		setupCharacterAddedFunction()
	end

	JumpButton.Parent = parentFrame
end

return TouchJump
