function TouchJump.Enable(B)ExternallyEnabled=true enableButton()end function TouchJump.Disable(B)ExternallyEnabled=false disableButton()end function TouchJump.Create(r,B)if JumpButton then JumpButton:Destroy()JumpButton=nil end local z=math.min(B.AbsoluteSize.x,B.AbsoluteSize.y)local n=z<=500 local t=n 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=n and UDim2.new(1,-(t*1.5-10),1,-t-20)or UDim2.new(1,-(t*1.5-10),1,-t*1.75)local J=nil JumpButton.InputBegan:connect(function(B)if J or B.UserInputType~=Enum.UserInputType.Touch or B.UserInputState~=Enum.UserInputState.Begin then return end J=B JumpButton.ImageRectOffset=Vector2.new(0,222)MasterControl:SetIsJumping(true)end)OnInputEnded=function()J=nil MasterControl:SetIsJumping(false)JumpButton.ImageRectOffset=Vector2.new(176,222)end JumpButton.InputEnded:connect(function(B)if B==J then OnInputEnded()end end)GuiService.MenuOpened:connect(function()if J then OnInputEnded()end end)if not CharacterAddedConnection then setupCharacterAddedFunction()end JumpButton.Parent=B end return TouchJump
--
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
