function TouchJump.Enable(K)JumpButton.Visible=true end function TouchJump.Disable(K)JumpButton.Visible=false OnInputEnded()end function TouchJump.Create(D,K)if JumpButton then JumpButton:Destroy()JumpButton=nil end local O=K.AbsoluteSize.y<=500 local r=O and 70 or 90 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,r,0,r)JumpButton.Position=O and UDim2.new(1,r*-2.25,1,-r-20)or UDim2.new(1,r*-2.75,1,-r-120)local l=nil JumpButton.InputBegan:connect(function(K)if l or K.UserInputType~=Enum.UserInputType.Touch then return end l=K JumpButton.ImageRectOffset=Vector2.new(0,222)if MasterControl then MasterControl(true)end end)OnInputEnded=function()l=nil if MasterControl then MasterControl(false)end JumpButton.ImageRectOffset=Vector2.new(176,222)end JumpButton.InputEnded:connect(function(K)if K==l then OnInputEnded()end end)JumpButton.Parent=K return function(K)MasterControl=K end end return TouchJump
--[[ Public API ]]
--
function TouchJump:Enable()
	JumpButton.Visible = true
end

function TouchJump:Disable()
	JumpButton.Visible = false
	OnInputEnded()
end

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

	local isSmallScreen = parentFrame.AbsoluteSize.y <= 500
	local jumpButtonSize = isSmallScreen and 70 or 90

	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 * -2.25, 1, -jumpButtonSize - 20)
		or UDim2.new(1, jumpButtonSize * -2.75, 1, -jumpButtonSize - 120)

	local touchObject = nil
	JumpButton.InputBegan:connect(function(inputObject)
		if touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
			return
		end

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

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

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

	JumpButton.Parent = parentFrame
	return function(func)
		MasterControl = func
	end
end

return TouchJump
