--Connect Mouse1Down/Up events to the button to register touch input
--Use MouseButton1Down instead of input start to ensure it only registers touches that originate on the button

EnterImageButton.MouseButton1Down:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		--Only register it when in touch mode so that PC users dont click on it by accident
		EnterImageButton.ImageTransparency = 1
		EnterImageButton.Pressed.ImageTransparency = 0

		EnterKeyDown = true
		enterStart()
	end
end)

EnterImageButton.MouseButton1Up:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		EnterKeyDown = false
		--Return button image to unpressed
		EnterImageButton.ImageTransparency = 0
		EnterImageButton.Pressed.ImageTransparency = 1
	end
end)

EnterImageButton.InputEnded:Connect(function(Input)
	--Use a third connection to prevent the button getting stuck in pressed mode
	if Input.UserInputType == Enum.UserInputType.Touch then
		--Return button image to unpressed, user has stopped touching the button
		EnterImageButton.ImageTransparency = 0
		EnterImageButton.Pressed.ImageTransparency = 1
	end
end)

FlipImageButton.MouseButton1Down:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 1
		FlipImageButton.Pressed.ImageTransparency = 0
	end
end)

FlipImageButton.MouseButton1Up:Connect(function()
	if UserInputService:GetLastInputType() == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 0
		FlipImageButton.Pressed.ImageTransparency = 1
		if AdornedSeat then
			if isFlipped(AdornedSeat) then
				flipSeat()
			end
		end
	end
end)

EnterImageButton.InputEnded:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.Touch then
		FlipImageButton.ImageTransparency = 0
		FlipImageButton.Pressed.ImageTransparency = 1
	end
end)
