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

	JumpButton.Parent = parentFrame
end

return TouchJump
